Skip to content

Instantly share code, notes, and snippets.

@sleexyz
Created August 5, 2016 01:31
Show Gist options
  • Save sleexyz/5d4a754ecc447157f81a9a3d73f4dbfc to your computer and use it in GitHub Desktop.
Save sleexyz/5d4a754ecc447157f81a9a3d73f4dbfc to your computer and use it in GitHub Desktop.
-- How do we make a tuple that's functorial over the first parameter?
-- We can't!
data Tup a b = Tup a b
instance Functor (Tup a) where
fmap f (Tup x y) = Tup x (f y)
instance Functor (Tup a) where
fmap f (Tup x y) = Tup x (f y)
-- -- Invalid Haskell, unfortunately:
-- instance Functor (\a -> (a,b)) where
-- fmap f (x,y) = (f x, y)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment