Skip to content

Instantly share code, notes, and snippets.

@yashigani
Created March 8, 2013 12:22
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 yashigani/5116116 to your computer and use it in GitHub Desktop.
Save yashigani/5116116 to your computer and use it in GitHub Desktop.
すごいH本読書会 in 大阪 #6
data Akari a = Waai a (Akari a) | Daisuki deriving (Show)
data H oo gle = H oo oo oo oo oo gle deriving (Show)
data Ha y oo = Ha y oo oo oo oo oo deriving (Show)
data O b = OOOO|OOOOOO|O|OO deriving (Show)
data Hom r a = Hom (r -> a)
data State s a = State (s -> (a, s))
data Just a = Nothing | Maybe (Maybe a)
instance Functor Akari where
fmap _ Daisuki = Daisuki
fmap f (Waai a akari) = Waai (f a) (fmap f akari)
instance Functor (H oo) where
fmap f (H a b c d e gle) = H a b c d e (f gle)
instance Functor (Ha y) where
fmap f (Ha y a b c e d) = Ha y (f a) (f b) (f c) (f d) (f e)
instance Functor O where
fmap _ OOOO = OOOO
fmap _ OOOOOO = OOOOOO
fmap _ O = O
fmap _ OO = OO
instance Functor (Hom r) where
fmap f (Hom a) = Hom (f . a)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment