HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

ModuleAgda-2.7.0.1Haskell2010

Agda.Utils.Semigroup

Some semigroup instances used in several places

  • 1 class
  • PackageAgda-2.7.0.1
  • Exports1
  • LanguageHaskell2010
  • LicenceMIT
  • SourceSemigroup.hs
classclass Semigroup a where
#

The class of semigroups (types with an associative binary operation).

Instances should satisfy the following:

Associativity

x <> (y <> z) = (x <> y) <> z

You can alternatively define sconcat instead of (<>), in which case the laws are:

Unit

sconcat (pure x) = x

Multiplication

sconcat (join xss) = sconcat (fmap sconcat xss)

Methods

  • (<>) :: a -> a -> ainfixr 6

    An associative operation.

    Examples
    Example1 expression
    [1,2,3] <> [4,5,6][1,2,3,4,5,6]
    Example1 expression
    Just [1, 2, 3] <> Just [4, 5, 6]Just [1,2,3,4,5,6]
    Example1 expression
    putStr "Hello, " <> putStrLn "World!"Hello, World!
Instances241Semigroup, …

Orphan instances

2 instances