Workshop/MiracleHaskell/021-answer

みんなの宿題

infixr 5 :-:  
data List a = Empty | a :-: (List a) deriving (Show, Read, Eq, Ord)

myMap :: (a -> b) -> List a -> List b
myMap _ Empty = Empty
myMap f (x :-: xs) = f x :-: myMap f xs

instance Functor List where
    fmap = myMap

テスト含むソースコード全体