-
Notifications
You must be signed in to change notification settings - Fork 26
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
Add Apply instance for Map #16
Conversation
Seems sensible, but there are a couple of questions I'd like to answer first:
|
Adding
Edit: There is a trivial apply: |
Having reflected on it a bit, the exact property that this trivialApply :: forall a b c. (a -> Maybe (b -> c)) -> (a -> Maybe b) -> a -> Maybe c
trivialApply _ _ _ = Nothing
apply :: forall a b c. (a -> Maybe (b -> c)) -> (a -> Maybe b) -> a -> Maybe c
apply m1 m2 a = m1 a <*> m2 a (Sketch of proof: any non- Obviously What I don't have an argument for is why I want to make the initial constraint that an ... Maybe that, coupled with the precedent that Haskell has set, is good enough for you? |
Thanks! yeah that's some really good analysis, definitely good enough for me. Do you think a similar line of argument would work for |
Yeah, if the trivialBind :: forall a b c. (a -> Maybe b) -> (b -> a -> Maybe c) -> a -> Maybe c
trivialBind _ _ _ = Nothing
bind :: forall a b c. (a -> Maybe b) -> (b -> a -> Maybe c) -> a -> Maybe c
bind m f a = m a >>= flip f a as the only two inhabitants, and the nontrivial one corresponds to the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good. Thanks! I'll just leave this open for a while in case anyone else wants to add any comments.
If we look at the equivalent minimal definition So just like there's no guarantee of there being some special canonical All this to say that @rhendric's |
No description provided.