diff options
Diffstat (limited to 'functor/h1.hs')
-rw-r--r-- | functor/h1.hs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/functor/h1.hs b/functor/h1.hs new file mode 100644 index 0000000..11688ad --- /dev/null +++ b/functor/h1.hs @@ -0,0 +1,7 @@ +data MyEither a b = MyLeft a | MyRight b + deriving (Show) + +instance Functor (MyEither a) where + fmap f (MyLeft a) = MyLeft a + fmap f (MyRight b) = MyRight (f b) + |