Gabriella439 / Gabriella439/Haskell-MMorph-Library

Add a fork/major version for GHC >= 8.6

Open
#50 12 comments 0 reactions 0 assignees View on GitHub
Dominant language
Haskell
Stars
53
Forks
24
PR merge metrics
No merged PRs in 30d

Description

As you've already seen, GHC 8.6 wins

```haskell
instance (MFunctor f, MFunctor g, forall m. Monad m => Monad (g m))
=> MFunctor (ComposeT f g)
```

But it has more to offer. We can change the `MonadTrans` instance to the (effectively) less-constrained, and sometimes more efficient,

```haskell
instance (MonadTrans f, MonadTrans g, forall m. Monad m => Monad (g m)) => MonadTrans (ComposeT f g)
where
lift = ComposeT . lift . lift
```

and then even change the type of `hoist` to

```haskell
hoist :: (Monad m, Monad n) => (forall a . m a -> n a) -> t m b -> t n b
```

which allows some important instances including `streamly` streams and Church-style free monad transformers.

Basically, aside from the fact that `QuantifiedConstraints` is a pain and a half for instance resolution, everything gets much nicer.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.