From a34e1e8806c5083712ef76114d4e6988cb3a25e3 Mon Sep 17 00:00:00 2001 From: Tissevert Date: Fri, 3 May 2019 19:06:24 +0200 Subject: [PATCH] Lift restrictions on base version and abandon Semigroup instance --- Mainate.cabal | 2 +- src/Stream.hs | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Mainate.cabal b/Mainate.cabal index 34d37ed..8db51e3 100644 --- a/Mainate.cabal +++ b/Mainate.cabal @@ -21,6 +21,6 @@ library exposed-modules: Stream -- other-modules: -- other-extensions: - build-depends: base >=4.12 && <4.13 + build-depends: base >=4.9 && <4.13 hs-source-dirs: src default-language: Haskell2010 diff --git a/src/Stream.hs b/src/Stream.hs index 7fefe2c..be6b61c 100644 --- a/src/Stream.hs +++ b/src/Stream.hs @@ -6,12 +6,10 @@ import Data.List (intercalate) data Stream a = Stream [(a, Stream a)] deriving Show -instance Semigroup (Stream a) where - (<>) (Stream []) b = b - (<>) (Stream pairs) b = Stream $ (\(a, stream) -> (a, stream <> b)) <$> pairs - instance Monoid (Stream a) where mempty = fromList [] + mappend (Stream []) b = b + mappend (Stream pairs) b = Stream $ (\(a, stream) -> (a, stream `mappend` b)) <$> pairs fromList :: [a] -> Stream a fromList [] = Stream []