Skip to content

Instantly share code, notes, and snippets.

@tonymorris
Created October 7, 2018 12:14
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tonymorris/57b39f039786af4ee94d046bd6c0a0c7 to your computer and use it in GitHub Desktop.
Save tonymorris/57b39f039786af4ee94d046bd6c0a0c7 to your computer and use it in GitHub Desktop.
data ToInt a = ToInt (a -> Int)
instance Functor ToInt where
-- note, f :: a -> b; g :: a -> Int, and the todo :: b -> Int
fmap f (ToInt g) = ToInt (error "todo")
class Contravariant f where
contramap :: (b -> a) -> f a -> f b
instance Contravariant ToInt where
-- note, f :: b -> a, g :: a -> Int, and the todo :: b -> Int
contramap f (ToInt g) = ToInt (error "todo")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment