Give up about the annoying breaking change in base about Monoid / Semigroup

This commit is contained in:
Tissevert 2019-05-05 12:27:03 +02:00
parent 1c93600ecf
commit 199df91c71

View file

@ -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 []