-
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
(Either e) instance of decodeText #1
Comments
Using a |
Currently, it isn’t actually locked down to I think it would be useful to include an That said, I used to be more enthusiastic about |
Okay, then I am going to close this issue and open another one for the Either implementation. An IO (or MonadThrow?) implementation is the other one that I would like, because that's useful for "Be UTF8 or die" with the functions defined in #2. |
“Be UTF8 or die” is antithetical to the spirit of this library, which is designed to never throw any exceptions, no matter what you do, so I don’t think it would be good to have an |
K. Then I'll just remake this issue to be for the Either implementation alone. |
Would you be interesting in updating the library to use
MonadFail
instead ofMaybe
to denote error conditions indecodeText
? We can specialize it (through theSPECIALIZE
pragma) toMaybe
, but it also opens up a whole world of other use cases and call sites.The catch with this suggestion is that
MonadFail
is being rolled out rather slowly...with effectively full adoption not coming into play until GHC 8.8 as per https://wiki.haskell.org/MonadFail_Proposal -- but the support inMaybe
has been there sincebase 4.9.0.0
as per https://hackage.haskell.org/package/base-4.11.0.0/docs/Control-Monad-Fail.html#t:MonadFail so for backwards compatibility, we could define theMonadFail
instance as an{-# OVERLAPPABLE #-}
instance (so as to not conflict with theMonad
instance) and conditionally included based on the CPP#if MIN_VERSION_base(4,9,0)
.If you're open to this change, I'm happy to submit the pull request.
The text was updated successfully, but these errors were encountered: