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 aas the only two inhabitants, and the nontrivial one corresponds to the |
hdgarrood
left a comment
There was a problem hiding this comment.
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.