Gabriella439 / Haskell-MMorph-Library

Monad morphisms
BSD 3-Clause "New" or "Revised" License
47 stars 26 forks source link

Quantified constraints #47

Closed masaeedu closed 5 years ago

masaeedu commented 5 years ago

Is it worth adding quantified constraints so an implementer of MFunctor et al is forced to provide a proof of the output of their type constructor being a monad in terms of a proof of the input being a monad?

Specifically:

class (forall m. Monad m => Monad (t m)) => MFunctor t where
  ...

I'm not sure if there's any use for it, but this would also allow use of the monad instance of t m in an implementation of MFunctor.

Gabriella439 commented 5 years ago

@masaeedu: That would only work for GHC 8.6 or later, but I'm still trying to support older GHC versions

masaeedu commented 5 years ago

Is it possible to use a preprocessor rule to compile differently for >= 8.6 and < 8.6?

Gabriella439 commented 5 years ago

Yes, but I think it might cause issues if the behavior of the library changes between GHC versions

masaeedu commented 5 years ago

Alright then. :+1: