Skip to content

Instantly share code, notes, and snippets.



Created May 19, 2018
What would you like to do?
{-# LANGUAGE RankNTypes #-}
-- A natural transformation.
data NT f g = NT { nt :: forall a. f a -> g a }
-- Natural transformation from Maybe to [].
maybeListNT :: NT Maybe []
maybeListNT = NT (maybe [] pure)

This comment has been minimized.

Copy link
Owner Author

@phaazon phaazon commented May 19, 2018

You can test it with:

nt maybeListNT (Just "hey")

Which yields

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.