view src/list.hs @ 18:086fc8bb6ea9

Add description for category/functor in program
author Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
date Sun, 08 Feb 2015 21:19:55 +0900
parents
children
line wrap: on
line source

data List a = Nil | Cons a (List a) deriving (Show)

instance Functor List where
    fmap f Nil = Nil
    fmap f (Cons x xs) = Cons (f x) (fmap f xs)