Created
February 28, 2015 11:57
-
-
Save MiyamonY/e6a3a19fd156c5a2b187 to your computer and use it in GitHub Desktop.
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
-- instance Functor ((->) r) where | |
-- fmap f g = (\ x -> f (g x)) | |
-- instance Functor ((->) r) where | |
-- fmap = (.) | |
-- functor laws | |
-- first law | |
-- isntance Fucntor Maybe where | |
-- famp f (Just x) = Just (f x) | |
-- fmap f Nothing = Nothing | |
-- second law | |
data CMaybe a = CNothing | CJust Int a deriving (Show) | |
instance Functor CMaybe where | |
fmap f CNothing = CNothing | |
fmap f (CJust counter x) = CJust (succ counter) (f x) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment