Skip to content

Instantly share code, notes, and snippets.

@co-dan
Created March 14, 2013 11:42
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 co-dan/5160730 to your computer and use it in GitHub Desktop.
Save co-dan/5160730 to your computer and use it in GitHub Desktop.
import Data.Functor.Compose
data N n = N { unN :: n Int }
f :: (Functor n, Functor m) => (Int -> m Int) -> N n -> N (Compose n m)
f h = N . Compose . fmap h . unN
-- f h (N x) = N $ Compose (fmap h x)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment