Add remaining haskell book exercises
This commit is contained in:
9
Haskell-book/17/Identity.hs
Normal file
9
Haskell-book/17/Identity.hs
Normal file
@@ -0,0 +1,9 @@
|
||||
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
|
||||
Reference in New Issue
Block a user