Skip to content

Instantly share code, notes, and snippets.

@kuribas
Created February 19, 2019 14:23
Show Gist options
  • Save kuribas/6313a64a91297c8dbe4a61c8dcd97c22 to your computer and use it in GitHub Desktop.
Save kuribas/6313a64a91297c8dbe4a61c8dcd97c22 to your computer and use it in GitHub Desktop.
-- this is the same as Functor fmap, but that instance cannot be
-- written, since the type variable is one level too deep.
fixmap :: (Functor (f a), Bifunctor f) => (a -> b) -> Fix (f a) -> Fix (f b)
fixmap f = cata (Rec . first f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment