Give up about the annoying breaking change in base about Monoid / Semigroup
This commit is contained in:
parent
1c93600ecf
commit
199df91c71
1 changed files with 6 additions and 4 deletions
|
@ -10,10 +10,12 @@ import Data.List (intercalate)
|
||||||
|
|
||||||
data Stream a = Stream [(a, Stream a)] deriving Show
|
data Stream a = Stream [(a, Stream a)] deriving Show
|
||||||
|
|
||||||
instance Monoid (Stream a) where
|
empty :: Stream a
|
||||||
mempty = fromList []
|
empty = fromList []
|
||||||
mappend (Stream []) b = b
|
|
||||||
mappend (Stream pairs) b = Stream $ (\(a, stream) -> (a, stream `mappend` b)) <$> pairs
|
append :: Stream a -> Stream a -> Stream a
|
||||||
|
append (Stream []) b = b
|
||||||
|
append (Stream pairs) b = Stream $ (\(a, stream) -> (a, stream `append` b)) <$> pairs
|
||||||
|
|
||||||
fromList :: [a] -> Stream a
|
fromList :: [a] -> Stream a
|
||||||
fromList [] = Stream []
|
fromList [] = Stream []
|
||||||
|
|
Loading…
Reference in a new issue