Skip to content

Instantly share code, notes, and snippets.

@jjant
Last active August 7, 2018 21:15
Show Gist options
  • Save jjant/7fcc5db59e10eee67a41d10902ca9925 to your computer and use it in GitHub Desktop.
Save jjant/7fcc5db59e10eee67a41d10902ca9925 to your computer and use it in GitHub Desktop.
{-# LANGUAGE InstanceSigs #-}
instance Functor (Cont r) where
fmap :: (a -> b) -> Cont r a -> Cont r b
-- Equivalent to
-- fmap :: (a -> b) -> ((a -> r) -> r) -> ((b -> r) -> r)
fmap f (Cont g) = Cont $ \k -> g (\a -> k (f a))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment