Skip to content

Instantly share code, notes, and snippets.

@klapaucius
Created November 25, 2011 08:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save klapaucius/1393078 to your computer and use it in GitHub Desktop.
Save klapaucius/1393078 to your computer and use it in GitHub Desktop.
class Functor f where
type C f a :: Constraint
type C f a = ()
fmap :: (C f a, C f b) => (a -> b) -> f a -> f b
-- Инстансы для "неограниченных" функторов остались без изменений:
instance Functor [] where
fmap = map
instance Functor Set where
type C Set a = Ord a
fmap = Set.map
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment