Add remaining haskell book exercises
This commit is contained in:
10
Haskell-book/15/orphan-instance/Listy.hs
Normal file
10
Haskell-book/15/orphan-instance/Listy.hs
Normal file
@@ -0,0 +1,10 @@
|
||||
module Listy where
|
||||
|
||||
newtype Listy a =
|
||||
Listy [a]
|
||||
deriving (Eq, Show)
|
||||
|
||||
instance Monoid (Listy a) where
|
||||
mempty = Listy []
|
||||
mappend (Listy l) (Listy l') =
|
||||
Listy $ mappend l l'
|
||||
9
Haskell-book/15/orphan-instance/ListyInstances.hs
Normal file
9
Haskell-book/15/orphan-instance/ListyInstances.hs
Normal file
@@ -0,0 +1,9 @@
|
||||
module ListyInstances where
|
||||
|
||||
import Data.Monoid
|
||||
import Listy
|
||||
|
||||
instance Monoid (Listy a) where
|
||||
mempty = Listy []
|
||||
mappend (Listy l) (Listy l') =
|
||||
Listy $ mappend l l'
|
||||
Reference in New Issue
Block a user