Last active
December 29, 2015 22:42
-
-
Save zudov/e7adef0d7563bc615001 to your computer and use it in GitHub Desktop.
ConstraintKinds, Functor, Set
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- | https://jeltsch.wordpress.com/2013/02/14/the-constraint-kind/ | |
{-# LANGUAGE ConstraintKinds, TypeFamilies #-} | |
import Prelude hiding (Functor(..)) | |
import Data.Set (Set) | |
import qualified Data.Set as Set | |
import GHC.Exts (Constraint) | |
class Functor f where | |
type Object f a :: Constraint | |
type Object f a = () | |
fmap :: (Object f a, Object f b) => (a -> b) -> f a -> f b | |
instance Functor Set where | |
type Object 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