Skip to content

Instantly share code, notes, and snippets.

@tonymorris tonymorris/ToInt.hs
Created Oct 7, 2018

Embed
What would you like to do?
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
You can’t perform that action at this time.