Skip to content

(Either e) instance of decodeText #1

@RobertFischer

Description

@RobertFischer

Would you be interesting in updating the library to use MonadFail instead of Maybe to denote error conditions in decodeText? We can specialize it (through the SPECIALIZE pragma) to Maybe, 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 in Maybe has been there since base 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 the MonadFail instance as an {-# OVERLAPPABLE #-} instance (so as to not conflict with the Monad 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions