diff options
Diffstat (limited to 'Haskell-book/16/Short.hs')
| -rw-r--r-- | Haskell-book/16/Short.hs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Haskell-book/16/Short.hs b/Haskell-book/16/Short.hs new file mode 100644 index 0000000..f6ecd66 --- /dev/null +++ b/Haskell-book/16/Short.hs @@ -0,0 +1,10 @@ +module Short where + +data Sum a b = + First a + | Second b + deriving (Eq, Show) + +instance Functor (Sum a) where + fmap f (Second x) = Second $ f x + fmap f (First x) = First x |
