Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Add composition of MonadTransformers

Open
#87 7 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
45/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Quiet
Tech stack
haskell
Domain
tooling

Research direction

Start by reading the proposed ComposeT definition and the existing MonadTrans implementations in the transformers package. Check how the type and kind signatures fit the library's supported language features, then verify that the OkT deriving example works; done means composed transformers can provide MonadTrans as described.

Written by the indexing model from the issue text.

Description

[original issue 84 by @Icelandjack]

Add

--      ComposeT :: MonadTransformer -> MonadTransformer -> MonadTransformer
type    ComposeT :: (k3 -> k2 -> Type) -> (k1 -> k3) -> (k1 -> k2 -> Type)
newtype ComposeT trans1 trans2 m a = ComposeT (trans1 (trans2 m) a)
  deriving newtype (Functor, Applicative, Monad)

instance (MonadTrans trans1, MonadTrans trans2) => MonadTrans (ComposeT trans1 trans2) where
  lift :: Monad m => m ~> ComposeT trans1 trans2 m
  lift = ComposeT . lift . lift

where MonadTransformer = (Type -> Type) -> (Type -> Type).

Now we can derive MonadTrans for transformers like

type    OkT :: MonadTransformer
newtype OkT m a = OkT (Int -> Int -> m a)
 deriving (Functor, Applicative, Monad)
 via ReaderT Int (ReaderT Int m)

 deriving MonadTrans
 via ComposeT (ReaderT Int) (ReaderT Int)
Dominant language
Haskell
Stars
5
Forks
10
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from haskell/transformers

All issues in haskell/transformers

Similar issues

More Haskell issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.