interface Semigroup a where
(<>) : a -> a -> a
A type with an associative binary operation (<>). (++) (below) is a synonym, conventional on lists and strings.
import nécessaire.interface Semigroup a where
(<>) : a -> a -> a
A type with an associative binary operation (<>). (++) (below) is a synonym, conventional on lists and strings.
(++) : Semigroup a => a -> a -> a
(++) is a synonym for (<>) — conventional on lists and strings, where the concrete type is known. In polymorphic code, prefer (<>).
interface Semigroup a => Monoid a where
mempty : a
A semigroup with an identity element mempty. Laws: mempty <> x == x and x <> mempty == x.
concat : Monoid m => List m -> m
Concatenate a list of monoid values: concat [a, b, c] = a <> b <> c, and concat [] = mempty. Works over any Monoid — lists of lists, lists of strings, … — combining the elements in order with (<>), using mempty as the result for the empty list. concat ["a", "b", "c"] = "abc" concat [[1], [2, 3]] = [1, 2, 3]