Created
July 10, 2018 01:40
-
-
Save Lysxia/147a593d32bf7d8d468b61b882c1b9ba to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE TypeFamilies, UndecidableInstances #-} | |
-- https://blog.poisson.chat/posts/2018-07-09-type-gadt.html | |
module UnMTL where | |
import Control.Monad.Trans.Reader | |
import Control.Monad.Trans.State | |
import Control.Monad.Trans.Except | |
import Data.Functor.Identity | |
import Data.Kind | |
type family UnMTL (a :: Type) :: Type | |
type instance UnMTL (ReaderT r m a) = r -> UnMTL (m a) | |
type instance UnMTL (StateT s m a) = s -> UnMTL (m (a, s)) | |
type instance UnMTL (ExceptT e m a) = UnMTL (m (Either e a)) | |
type instance UnMTL (Identity a) = a | |
type instance UnMTL (IO a) = IO a |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment