-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Free can openers #168
Comments
It's actually frequent to provide generic "cycled" (or mutual, not sure what would be a proper term here) implementations for base types and demand a user to provide a particular implementations for specific types. Example: class Eq a where
(==), (/=) :: a -> a -> Bool
-- Minimal complete definition:
-- (==) or (/=)
x /= y = not (x == y)
x == y = not (x /= y) So as you can see In case of the book I'm sure it was just an example that it might be implemented like that. |
Yep! It is necessary to define one or the other manually, but then you get it for free. |
@zerkms @DrBoolean thanks, I think we should state "minimal complete definition" in the book |
Hi, I'm reading Free can openers
map
is defined usingap
But
ap
is defined usingmap
, so is there a cycle here?map
is defined usingchain
But in Chapter 9,
chain
is defined usingmap
andjoin
, so is there a cycle here?The text was updated successfully, but these errors were encountered: