... | ... | @@ -18,16 +18,21 @@ Introducing `Semigroup` as a superclass of `Monoid` has been proposed several ti |
|
|
|
|
|
The final API (suitable for Haskell Report inclusion) we want to end up with is
|
|
|
|
|
|
```
|
|
|
modulePrelude(Semigroup((<>)),Monoid(mempty,mconcat)-- …)where-- …
|
|
|
```
|
|
|
|
|
|
```
|
|
|
moduleData.SemigroupwhereclassSemigroup a where(<>):: a -> a -> a
|
|
|
|
|
|
-- not (re)exported from Prelude
|
|
|
sconcat ::NonEmpty a -> a
|
|
|
sconcat (a :| as)= go a as
|
|
|
where
|
|
|
go b (c:cs)= b <> go c cs
|
|
|
go b []= b
|
|
|
|
|
|
-- GHC extension, not needed for Haskell Report
|
|
|
-- GHC extension, not needed for Haskell Report-- & not (re)exported from Prelude
|
|
|
stimes ::Integral b => b -> a -> a
|
|
|
stimes y0 x0 ={- default impl -}
|
|
|
```
|
... | ... | @@ -39,7 +44,7 @@ moduleData.MonoidwhereclassSemigroup a =>Monoid a where |
|
|
mconcat ::[a]-> a
|
|
|
mconcat = foldr (<>) mempty
|
|
|
|
|
|
-- GHC extension, not needed for Haskell Report
|
|
|
-- GHC extension, not needed for Haskell Report-- & not (re)exported from Prelude
|
|
|
mtimes ::Integral b => b -> a -> a
|
|
|
mtimes y0 x0 ={- default impl -}-- GHC Extension: Legacy alias not needed for Haskell Reportmappend::Semigroup a => a -> a -> a
|
|
|
mappend=(<>)
|
... | ... | |