Skip to content

Commit 4fb7669

Browse files
authored
add Functor (#40)
1 parent ec60f5a commit 4fb7669

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

MonadTransformers/4.4/Functor2.hs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{-# LANGUAGE FunctionalDependencies #-}
2+
{-# LANGUAGE FlexibleInstances #-}
3+
module Functor2 where
4+
5+
6+
class Functor' c e | c -> e where
7+
fmap' :: (e -> e) -> c -> c
8+
9+
10+
instance Functor' (Maybe e) e where
11+
fmap' _ Nothing = Nothing
12+
fmap' f (Just x) = Just $ f x
13+
14+
15+
instance Functor' [e] e where
16+
fmap' = map

0 commit comments

Comments
 (0)