Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle conditional typeclass implementations #2

Open
Avaq opened this issue Aug 16, 2021 · 1 comment
Open

Handle conditional typeclass implementations #2

Avaq opened this issue Aug 16, 2021 · 1 comment

Comments

@Avaq
Copy link
Collaborator

Avaq commented Aug 16, 2021

Some types have type class implementations only when they have specific inner types.

Some examples:

@dotnetCarpenter
Copy link
Owner

My bad for only testing with String and Number, and didn't see a difference.

There are great examples at all of the Sanctuary provided ADT's README.

Pair:

Z[k].test (Pair (Useless) (Useless))
Z[k].test (Pair (['foo']) (['bar']))

https://github.com/sanctuary-js/sanctuary-pair#readme

Maybe:

Z[k].test (Just (Useless))
Z[k].test (Nothing)

https://github.com/sanctuary-js/sanctuary-maybe#readme

Either:

Z[k].test (Right (Useless))
Z[k].test (Right (['foo']))

https://github.com/sanctuary-js/sanctuary-either#readme

Fluture ???
https://github.com/fluture-js/Fluture

@Avaq I'm guessing that since Future only ever holds a function, a Future's Type Class implementations are always the same? Oh, I forgot about ConcurrentFuture, which is not a Monad.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants