Files
book-exercises/Haskell-book/17/Identity.hs

10 lines
247 B
Haskell

newtype Identity a = Identity a
deriving (Eq, Show, Ord)
instance Functor Identity where
fmap f (Identity x) = Identity $ f x
instance Applicative Identity where
pure x = Identity x
(Identity f) <*> (Identity y) = Identity $ f y