Skip to content

Instantly share code, notes, and snippets.

@Lysxia
Created July 29, 2019 14:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Lysxia/9c11a9102a1539b0c3d53212856ce7bc to your computer and use it in GitHub Desktop.
Save Lysxia/9c11a9102a1539b0c3d53212856ce7bc to your computer and use it in GitHub Desktop.
{-# Language KindSignatures, RankNTypes, DerivingVia #-}
newtype Foo i o m r = Foo (Await i m r -> Yield o m r -> m r)
newtype Pipe i o m a = Pipe (forall xx. (a -> Await i m xx -> Yield o m xx -> m xx) -> (Await i m xx -> Yield o m xx -> m xx))
deriving (Functor, Applicative, Monad)
via Codensity (Foo i o m)
-- Fluff --
data Await i (m :: * -> *) r
data Yield i (m :: * -> *) r
instance Functor (Codensity m)
instance Applicative (Codensity m)
instance Monad (Codensity m)
newtype Codensity m a = CD (forall r. (a -> m r) -> m r)
main = main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment