Skip to content

Instantly share code, notes, and snippets.

@kuribas
Last active November 14, 2018 10:46
Show Gist options
  • Save kuribas/684fc5b6d610f96cc19a9e6232e6cf97 to your computer and use it in GitHub Desktop.
Save kuribas/684fc5b6d610f96cc19a9e6232e6cf97 to your computer and use it in GitHub Desktop.
forall in type
{-# LANGUAGE RankNTypes #-}
module Test where
type MyType a = forall m. Monad m => m a
test :: MyType Int
test = pure 3
x :: IO Int
x = test
{-# LANGUAGE RankNTypes, FlexibleContexts #-}
module Test where
import Control.Monad.Reader
type MyType a b = forall m. MonadReader b m => m a
test :: MyType Int Int
test = pure 3
x :: Int -> Int
x = test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment