-
Notifications
You must be signed in to change notification settings - Fork 7
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
Applicative instances #25
Comments
Sounds good to me, does @phadej have an opinion? A PR would be very welcome. |
I do see a benefit of having functions with A PR adding the same instances https://hackage.haskell.org/package/base-4.14.1.0/docs/Data-Maybe.html#t:Maybe has is fine. As long as there is disclaimer which would allow us to close issues re. bottoms with "you have been warned". |
TL;DR I'm quite sure there would be issues like "I swapped lazy maybe to strict maybe, and my program started to crash instead of running faster". |
That would only affect new users that attempt to take advantage of this feature, though - it doesn't cause any backwards-compat issues as the instance doesn't exist currently so nobody would be using it. |
Yes, I it won't break any existing code. I didn't mean that. |
Let us wait for a patch. I'd expect an instances come with a documentation of their partial lawfulness. |
I'm confused by this because there is a > let f = const ()
> let g = const undefined
> fmap (f . g) (Data.Strict.Just ())
Just ()
> (fmap f . fmap g) (Data.Strict.Just ())
*** Exception: Prelude.undefined Or did I misinterpret something? |
@tomjaguarpaw we agreed to add instances. We are waiting for a patch. |
In
Data.Strict.Maybe
, I see the following argument for omitting theApplicative
instance:However, I don’t think it holds water, because by the same token Haskell doesn’t even have the
State
monad, see http://www.cse.chalmers.se/~nicsma/no-state-monad.htmlInstead, I think the right thing to do is to acknowledge that type class laws typically hold only if we ignore bottom, and implement the usual
Applicative
andMonad
instances for the strictMaybe
(and other types in the library).The text was updated successfully, but these errors were encountered: