HORIZON HASKELLDocslts/ghc-10.0.xc7d136e2026-10-12Search names, modules, packages, or :: a typeCtrl K

GHC 10.0.0.20260917 · lts/ghc-10.0.x · c7d136e · 2026-10-12

Modulecomonad-5.0.10

Control.Comonad.Traced

  • 13 types
  • 6 classes
  • 16 values
value(<<=) :: Comonad w => (w a -> b) -> w a -> w b
#
value(=<=) :: Comonad w => (w b -> c) -> (w a -> b) -> w a -> c
#
value(=>=) :: Comonad w => (w a -> b) -> (w b -> c) -> w a -> c
#
value(=>>) :: Comonad w => w a -> (w a -> b) -> w b
#
value($>) :: Functor f => f a -> b -> f b
#

Flipped version of <$.

Examples

Replace the contents of a Maybe Int with a constant String:

Example1 expression
Nothing $> "foo"Nothing
Example1 expression
Just 90210 $> "foo"Just "foo"

Replace the contents of an Either Int Int with a constant String, resulting in an Either Int String:

Example1 expression
Left 8675309 $> "foo"Left 8675309
Example1 expression
Right 8675309 $> "foo"Right "foo"

Replace each element of a list with a constant String:

Example1 expression
[1,2,3] $> "foo"["foo","foo","foo"]

Replace the second element of a pair with a constant String:

Example1 expression
(1,2) $> "foo"(1,"foo")
value(<$>) :: Functor f => (a -> b) -> f a -> f b
#

An infix synonym for fmap.

The name of this operator is an allusion to Prelude.$. Note the similarities between their types:

 ($)  ::              (a -> b) ->   a ->   b
(<$>) :: Functor f => (a -> b) -> f a -> f b

Whereas Prelude.$ is function application, <$> is function application lifted over a Functor.

Examples

Convert from a Maybe Int to a Maybe String using show:

Example1 expression
show <$> NothingNothing
Example1 expression
show <$> Just 3Just "3"

Convert from an Either Int Int to an Either Int String using show:

Example1 expression
show <$> Left 17Left 17
Example1 expression
show <$> Right 17Right "17"

Double each element of a list:

Example1 expression
(*2) <$> [1,2,3][2,4,6]

Apply even to the second element of a pair:

Example1 expression
even <$> (2,2)(2,True)
newtypenewtype Cokleisli (w :: k -> Type) (a :: k) b
#

Constructors

Instances8Category, Arrow, ArrowApply, ArrowChoice, ArrowLoop, Monad, …
classclass Functor w => Comonad (w :: Type -> Type) where
#

Methods

Instances12Comonad, …
classclass Comonad w => ComonadApply (w :: Type -> Type) where
#

Methods

  • (<@>) :: w (a -> b) -> w a -> w binfixl 4
  • (@>) :: w a -> w b -> w binfixl 4
  • (<@) :: w a -> w b -> w ainfixl 4
Instances9ComonadApply, …
classclass Comonad w => ComonadTraced m (w :: Type -> Type) | w -> m where
#

Methods

Instances5ComonadTraced
newtypenewtype TracedT m (w :: Type -> Type) a
#

Constructors

Instances11ComonadEnv, ComonadStore, ComonadTraced, ComonadTrans, ComonadHoist, Functor, …
classclass Functor (f :: Type -> Type) where
#

A type f is a Functor if it provides a function fmap which, given any types a and b lets you apply any function from (a -> b) to turn an f a into an f b, preserving the structure of f. Furthermore f needs to adhere to the following:

Identity

fmap id == id

Composition

fmap (f . g) == fmap f . fmap g

Note, that the second law follows from the free theorem of the type fmap and the first law, so you need only check that the former condition holds. See these articles by School of Haskell or David Luposchainsky for an explanation.

Methods

  • fmap :: (a -> b) -> f a -> f b

    fmap is used to apply a function of type (a -> b) to a value of type f a, where f is a functor, to produce a value of type f b. Note that for any type constructor with more than one parameter (e.g., Either), only the last type parameter can be modified with fmap (e.g., b in Either a b).

    Some type constructors with two parameters or more have a Bifunctor instance that allows both the last and the penultimate parameters to be mapped over.

    Examples

    Convert from a Maybe Int to a Maybe String using show:

    Example2 expressions
    fmap show NothingNothingfmap show (Just 3)Just "3"

    Convert from an Either Int Int to an Either Int String using show:

    Example2 expressions
    fmap show (Left 17)Left 17fmap show (Right 17)Right "17"

    Double each element of a list:

    Example1 expression
    fmap (*2) [1,2,3][2,4,6]

    Apply even to the second element of a pair:

    Example1 expression
    fmap even (2,2)(2,True)

    It may seem surprising that the function is only applied to the last element of the tuple compared to the list example above which applies it to every element in the list. To understand, remember that tuples are type constructors with multiple type parameters: a tuple of 3 elements (a,b,c) can also be written (,,) a b c and its Functor instance is defined for Functor ((,,) a b) (i.e., only the third parameter is free to be mapped over with fmap).

    It explains why fmap can be used with tuples containing values of different types as in the following example:

    Example1 expression
    fmap even ("hello", 1.0, 4)("hello",1.0,True)
  • (<$) :: a -> f b -> f ainfixl 4

    Replace all locations in the input with the same value. The default definition is fmap . const, but this may be overridden with a more efficient version.

    Examples

    Perform a computation with Maybe and replace the result with a constant value if it is Just:

    Example2 expressions
    'a' <$ Just 2Just 'a''a' <$ NothingNothing
Instances121Functor, …
classclass Semigroup a => Monoid a where
#

The class of monoids (types with an associative binary operation that has an identity). Instances should satisfy the following:

Right identity

x <> mempty = x

Left identity

mempty <> x = x

Associativity

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

(

Semigroup

law)

Concatenation

mconcat = foldr (<>) mempty

You can alternatively define mconcat instead of mempty, in which case the laws are:

Unit

mconcat (pure x) = x

Multiplication

mconcat (join xss) = mconcat (fmap mconcat xss)

Subclass

mconcat (toList xs) = sconcat xs

The method names refer to the monoid of lists under concatenation, but there are many other instances.

Some types can be viewed as a monoid in more than one way, e.g. both addition and multiplication on numbers. In such cases we often define newtypes and make those instances of Monoid, e.g. Data.Semigroup.Sum and Data.Semigroup.Product.

NOTE: Semigroup is a superclass of Monoid since base-4.11.0.0.

Methods

  • mempty :: a

    Identity of mappend

    Examples
    Example1 expression
    "Hello world" <> mempty"Hello world"
    Example1 expression
    mempty <> [1, 2, 3][1,2,3]
  • mappend :: a -> a -> a

    An associative operation

    NOTE: This method is redundant and has the default implementation mappend = (<>) since base-4.11.0.0. Should it be implemented manually, since mappend is a synonym for (<>), it is expected that the two functions are defined the same way. In a future GHC release mappend will be removed from Monoid.

  • mconcat :: [a] -> a

    Fold a list using the monoid.

    For most types, the default definition for mconcat will be used, but the function is included in the class definition so that an optimized version can be provided for specific types.

    Example1 expression
    mconcat ["Hello", " ", "Haskell", "!"]"Hello Haskell!"
Instances72Monoid, …
  • Monoid ByteArrayDefined in base-4.23.0.0 · Data.Array.Byte
  • Monoid IntSetDefined in containers-0.8 · Data.IntSet.Internal

    mempty = empty

  • Monoid UnitDefined in deepseq-1.5.2.0 · Control.DeepSeq
  • Monoid AllDefined in ghc-internal-10.0.0 · GHC.Internal.Data.Semigroup.Internal
  • Monoid AnyDefined in ghc-internal-10.0.0 · GHC.Internal.Data.Semigroup.Internal
  • Monoid EventDefined in ghc-internal-10.0.0 · GHC.Internal.Event.Internal.Types
  • Monoid EventLifetimeDefined in ghc-internal-10.0.0 · GHC.Internal.Event.Internal.Types
  • Monoid LifetimeDefined in ghc-internal-10.0.0 · GHC.Internal.Event.Internal.Types

    mappend takes the longer of two lifetimes.

  • Monoid ExceptionContextDefined in ghc-internal-10.0.0 · GHC.Internal.Exception.Context
  • Monoid OrderingDefined in ghc-internal-10.0.0 · GHC.Internal.Base
  • Monoid DocDefined in pretty-1.1.3.6 · Text.PrettyPrint.HughesPJ
  • Monoid ()Defined in ghc-internal-10.0.0 · GHC.Internal.Base
  • Monoid (Comparison a)Defined in base-4.23.0.0 · Data.Functor.Contravariant

    mempty on comparisons always returns EQ. Without newtypes this equals pure (pure EQ).

    mempty :: Comparison a
    mempty = Comparison _ _ -> EQ
    
  • Monoid (Equivalence a)Defined in base-4.23.0.0 · Data.Functor.Contravariant

    mempty on equivalences always returns True. Without newtypes this equals pure (pure True).

    mempty :: Equivalence a
    mempty = Equivalence _ _ -> True
    
  • Monoid (Predicate a)Defined in base-4.23.0.0 · Data.Functor.Contravariant

    mempty on predicates always returns True. Without newtypes this equals pure True.

    mempty :: Predicate a
    mempty = _ -> True
    
  • Monoid (IntMap a)Defined in containers-0.8 · Data.IntMap.Internal

    mempty = empty

  • Monoid (Seq a)Defined in containers-0.8 · Data.Sequence.Internal

    mempty = empty

  • Monoid (MergeSet a)Defined in containers-0.8 · Data.Set.Internal
  • Monoid (EqM a)Defined in containers-0.8 · Utils.Containers.Internal.EqOrdUtil
  • Monoid (OrdM a)Defined in containers-0.8 · Utils.Containers.Internal.EqOrdUtil
  • Monoid (First a)Defined in ghc-internal-10.0.0 · GHC.Internal.Data.Monoid
  • Monoid (Last a)Defined in ghc-internal-10.0.0 · GHC.Internal.Data.Monoid
  • Monoid (Endo a)Defined in ghc-internal-10.0.0 · GHC.Internal.Data.Semigroup.Internal
  • Monoid (Doc a)Defined in pretty-1.1.3.6 · Text.PrettyPrint.Annotated.HughesPJ
  • Monoid [a]Defined in ghc-internal-10.0.0 · GHC.Internal.Base
  • Monoid a => Monoid (Identity a)Defined in ghc-internal-10.0.0 · GHC.Internal.Data.Functor.Identity
  • Monoid a => Monoid (Down a)Defined in ghc-internal-10.0.0 · GHC.Internal.Data.Ord
  • Monoid a => Monoid (Dual a)Defined in ghc-internal-10.0.0 · GHC.Internal.Data.Semigroup.Internal
  • Monoid a => Monoid (STM a)Defined in ghc-internal-10.0.0 · GHC.Internal.STM
  • Monoid a => Monoid (Q a)Defined in ghc-internal-10.0.0 · GHC.Internal.TH.Monad
  • Monoid a => Monoid (IO a)Defined in ghc-internal-10.0.0 · GHC.Internal.Base
  • Monoid a => Monoid (a)Defined in ghc-internal-10.0.0 · GHC.Internal.Base
  • Monoid m => Monoid (WrappedMonoid m)Defined in base-4.23.0.0 · Data.Semigroup
  • Monoid p => Monoid (Par1 p)Defined in ghc-internal-10.0.0 · GHC.Internal.Generics
  • Semigroup a => Monoid (Maybe a)Defined in ghc-internal-10.0.0 · GHC.Internal.Base

    Lift a semigroup into Maybe forming a Monoid according to http://en.wikipedia.org/wiki/Monoid: "Any semigroup S may be turned into a monoid simply by adjoining an element e not in S and defining e*e = e and e*s = s = s*e for all s ∈ S."

    Since 4.11.0: constraint on inner a value generalised from Monoid to Semigroup.

  • Bits a => Monoid (Ior a)Defined in ghc-internal-10.0.0 · GHC.Internal.Data.Bits
  • Bits a => Monoid (Xor a)Defined in ghc-internal-10.0.0 · GHC.Internal.Data.Bits
  • FiniteBits a => Monoid (And a)Defined in ghc-internal-10.0.0 · GHC.Internal.Data.Bits

    This constraint is arguably too strong. However, as some types (such as Natural) have undefined complement, this is the only safe choice.

  • FiniteBits a => Monoid (Iff a)Defined in ghc-internal-10.0.0 · GHC.Internal.Data.Bits

    This constraint is arguably too strong. However, as some types (such as Natural) have undefined complement, this is the only safe choice.

  • Ord a => Monoid (Set a)Defined in containers-0.8 · Data.Set.Internal

    mempty = empty

  • Ord a => Monoid (Max a)Defined in ghc-internal-10.0.0 · GHC.Internal.Data.Functor.Utils
  • Ord a => Monoid (Min a)Defined in ghc-internal-10.0.0 · GHC.Internal.Data.Functor.Utils
  • Num a => Monoid (Product a)Defined in ghc-internal-10.0.0 · GHC.Internal.Data.Semigroup.Internal
  • Num a => Monoid (Sum a)Defined in ghc-internal-10.0.0 · GHC.Internal.Data.Semigroup.Internal
  • (Ord a, Bounded a) => Monoid (Max a)Defined in base-4.23.0.0 · Data.Semigroup
  • (Ord a, Bounded a) => Monoid (Min a)Defined in base-4.23.0.0 · Data.Semigroup
  • (Generic a, Monoid (Rep a ())) => Monoid (Generically a)Defined in ghc-internal-10.0.0 · GHC.Internal.Generics
  • Monoid (Proxy s)Defined in ghc-internal-10.0.0 · GHC.Internal.Data.Proxy
  • Monoid (U1 p)Defined in ghc-internal-10.0.0 · GHC.Internal.Generics
  • Monoid a => Monoid (Op a b)Defined in base-4.23.0.0 · Data.Functor.Contravariant

    mempty @(Op a b) without newtypes is mempty @(b->a) = _ -> mempty.

    mempty :: Op a b
    mempty = Op _ -> mempty
    
  • Monoid a => Monoid (ST s a)Defined in ghc-internal-10.0.0 · GHC.Internal.Control.Monad.ST.Lazy.Imp
  • Monoid a => Monoid (ST s a)Defined in ghc-internal-10.0.0 · GHC.Internal.ST
  • Monoid b => Monoid (a -> b)Defined in ghc-internal-10.0.0 · GHC.Internal.Base
  • Ord k => Monoid (Map k v)Defined in containers-0.8 · Data.Map.Internal

    mempty = empty

  • (Monoid a, Monoid b) => Monoid (a, b)Defined in ghc-internal-10.0.0 · GHC.Internal.Base
  • Alternative f => Monoid (Alt f a)Defined in ghc-internal-10.0.0 · GHC.Internal.Data.Semigroup.Internal
  • Applicative f => Monoid (Traversed a f)Defined in indexed-traversable-0.1.5 · WithIndex
  • Monad m => Monoid (Sequenced a m)Defined in indexed-traversable-0.1.5 · WithIndex
  • Monoid (f p) => Monoid (Rec1 f p)Defined in ghc-internal-10.0.0 · GHC.Internal.Generics
  • Monoid a => Monoid (Const a b)Defined in ghc-internal-10.0.0 · GHC.Internal.Data.Functor.Const
  • Monoid a => Monoid (Constant a b)Defined in transformers-0.6.3.0 · Data.Functor.Constant
  • (Applicative f, Monoid a) => Monoid (Ap f a)Defined in ghc-internal-10.0.0 · GHC.Internal.Data.Monoid
  • (Monoid a, Monoid b, Monoid c) => Monoid (a, b, c)Defined in ghc-internal-10.0.0 · GHC.Internal.Base
  • (Semigroup a, Monoid a) => Monoid (Tagged s a)Defined in tagged-0.8.11 · Data.Tagged
  • Monoid c => Monoid (K1 i c p)Defined in ghc-internal-10.0.0 · GHC.Internal.Generics
  • (Monoid (f a), Monoid (g a)) => Monoid (Product f g a)Defined in base-4.23.0.0 · Data.Functor.Product
  • (Monoid (f p), Monoid (g p)) => Monoid ((:*:) f g p)Defined in ghc-internal-10.0.0 · GHC.Internal.Generics
  • (Monoid a, Monoid b, Monoid c, Monoid d) => Monoid (a, b, c, d)Defined in ghc-internal-10.0.0 · GHC.Internal.Base
  • Monoid (f (g a)) => Monoid (Compose f g a)Defined in base-4.23.0.0 · Data.Functor.Compose
  • Monoid (f (g p)) => Monoid ((:.:) f g p)Defined in ghc-internal-10.0.0 · GHC.Internal.Generics
  • Monoid (f p) => Monoid (M1 i c f p)Defined in ghc-internal-10.0.0 · GHC.Internal.Generics
  • (Monoid a, Monoid b, Monoid c, Monoid d, Monoid e) => Monoid (a, b, c, d, e)Defined in ghc-internal-10.0.0 · GHC.Internal.Base
method(<>) :: a -> a -> a
#

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!
newtypenewtype Ap (f :: k -> Type) (a :: k)
#

This data type witnesses the lifting of a Monoid into an Applicative pointwise.

Examples
Example1 expression
Ap (Just [1, 2, 3]) <> Ap NothingAp {getAp = Nothing}
Example1 expression
Ap [Sum 10, Sum 20] <> Ap [Sum 1, Sum 2]Ap {getAp = [Sum {getSum = 11},Sum {getSum = 12},Sum {getSum = 21},Sum {getSum = 22}]}

Constructors

Instances24Generic1, Monad, Functor, MonadFix, MonadFail, Applicative, …
newtypenewtype First a
#

Maybe monoid returning the leftmost non-Nothing value.

First a is isomorphic to Alt Maybe a, but precedes it historically.

Beware that Data.Monoid.First is different from Data.Semigroup.First. The former returns the first non-Nothing, so Data.Monoid.First Nothing <> x = x. The latter simply returns the first value, thus Data.Semigroup.First Nothing <> x = Data.Semigroup.First Nothing.

Examples
Example1 expression
First (Just "hello") <> First Nothing <> First (Just "world")First {getFirst = Just "hello"}
Example1 expression
First Nothing <> memptyFirst {getFirst = Nothing}

Constructors

Instances20Monad, Functor, MonadFix, Applicative, Foldable, Traversable, …
newtypenewtype Last a
#

Maybe monoid returning the rightmost non-Nothing value.

Last a is isomorphic to Dual (First a), and thus to Dual (Alt Maybe a)

Data.Semigroup.Last. The former returns the last non-Nothing, so x <> Data.Monoid.Last Nothing = x. The latter simply returns the last value, thus x <> Data.Semigroup.Last Nothing = Data.Semigroup.Last Nothing.

Examples
Example1 expression
Last (Just "hello") <> Last Nothing <> Last (Just "world")Last {getLast = Just "world"}
Example1 expression
Last Nothing <> memptyLast {getLast = Nothing}

Constructors

Instances20Monad, Functor, MonadFix, Applicative, Foldable, Traversable, …
newtypenewtype All
#

Boolean monoid under conjunction (&&).

All x <> All y = All (x && y)
Examples
Example1 expression
All True <> mempty <> All False)All {getAll = False}
Example1 expression
mconcat (map (\x -> All (even x)) [2,4,6,7,8])All {getAll = False}
Example1 expression
All True <> memptyAll {getAll = True}

Constructors

Instances11Bounded, Eq, Data, Ord, Read, Show, …
  • Bounded AllDefined in ghc-internal-10.0.0 · GHC.Internal.Data.Semigroup.Internal
  • Eq AllDefined in ghc-internal-10.0.0 · GHC.Internal.Data.Semigroup.Internal
  • Data AllDefined in ghc-internal-10.0.0 · GHC.Internal.Data.Data
  • Ord AllDefined in ghc-internal-10.0.0 · GHC.Internal.Data.Semigroup.Internal
  • Read AllDefined in ghc-internal-10.0.0 · GHC.Internal.Data.Semigroup.Internal
  • Show AllDefined in ghc-internal-10.0.0 · GHC.Internal.Data.Semigroup.Internal
  • Generic AllDefined in ghc-internal-10.0.0 · GHC.Internal.Generics
  • Semigroup AllDefined in ghc-internal-10.0.0 · GHC.Internal.Data.Semigroup.Internal
  • Monoid AllDefined in ghc-internal-10.0.0 · GHC.Internal.Data.Semigroup.Internal
  • NFData AllDefined in deepseq-1.5.2.0 · Control.DeepSeq
  • type Rep All = D1 ('MetaData "All" "GHC.Internal.Data.Semigroup.Internal" "ghc-internal" 'True) (C1 ('MetaCons "All" 'PrefixI 'True) (S1 ('MetaSel ('Just "getAll") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool)))Defined in ghc-internal-10.0.0 · GHC.Internal.Generics
newtypenewtype Alt (f :: k -> Type) (a :: k)
#

Monoid under <|>.

Alt l <> Alt r == Alt (l <|> r)
Examples
Example1 expression
Alt (Just 12) <> Alt (Just 24)Alt {getAlt = Just 12}
Example1 expression
Alt Nothing <> Alt (Just 24)Alt {getAlt = Just 24}

Constructors

Instances24Generic1, Monad, Functor, MonadFix, Applicative, Foldable, …
newtypenewtype Any
#

Boolean monoid under disjunction (||).

Any x <> Any y = Any (x || y)
Examples
Example1 expression
Any True <> mempty <> Any FalseAny {getAny = True}
Example1 expression
mconcat (map (\x -> Any (even x)) [2,4,6,7,8])Any {getAny = True}
Example1 expression
Any False <> memptyAny {getAny = False}

Constructors

Instances11Bounded, Eq, Data, Ord, Read, Show, …
  • Bounded AnyDefined in ghc-internal-10.0.0 · GHC.Internal.Data.Semigroup.Internal
  • Eq AnyDefined in ghc-internal-10.0.0 · GHC.Internal.Data.Semigroup.Internal
  • Data AnyDefined in ghc-internal-10.0.0 · GHC.Internal.Data.Data
  • Ord AnyDefined in ghc-internal-10.0.0 · GHC.Internal.Data.Semigroup.Internal
  • Read AnyDefined in ghc-internal-10.0.0 · GHC.Internal.Data.Semigroup.Internal
  • Show AnyDefined in ghc-internal-10.0.0 · GHC.Internal.Data.Semigroup.Internal
  • Generic AnyDefined in ghc-internal-10.0.0 · GHC.Internal.Generics
  • Semigroup AnyDefined in ghc-internal-10.0.0 · GHC.Internal.Data.Semigroup.Internal
  • Monoid AnyDefined in ghc-internal-10.0.0 · GHC.Internal.Data.Semigroup.Internal
  • NFData AnyDefined in deepseq-1.5.2.0 · Control.DeepSeq
  • type Rep Any = D1 ('MetaData "Any" "GHC.Internal.Data.Semigroup.Internal" "ghc-internal" 'True) (C1 ('MetaCons "Any" 'PrefixI 'True) (S1 ('MetaSel ('Just "getAny") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool)))Defined in ghc-internal-10.0.0 · GHC.Internal.Generics
newtypenewtype Dual a
#

The dual of a Monoid, obtained by swapping the arguments of (<>).

Dual a <> Dual b == Dual (b <> a)
Examples
Example1 expression
Dual "Hello" <> Dual "World"Dual {getDual = "WorldHello"}
Example1 expression
Dual (Dual "Hello") <> Dual (Dual "World")Dual {getDual = Dual {getDual = "HelloWorld"}}

Constructors

Instances23Monad, Functor, MonadFix, Applicative, Foldable, Traversable, …
newtypenewtype Endo a
#

The monoid of endomorphisms under composition.

Endo f <> Endo g == Endo (f . g)
Examples
Example2 expressions
let computation = Endo ("Hello, " ++) <> Endo (++ "!")appEndo computation "Haskell""Hello, Haskell!"
Example2 expressions
let computation = Endo (*3) <> Endo (+1)appEndo computation 16

Constructors

Instances4Generic, Semigroup, Monoid, Rep
newtypenewtype Product a
#

Monoid under multiplication.

Product x <> Product y == Product (x * y)
Examples
Example1 expression
Product 3 <> Product 4 <> memptyProduct {getProduct = 12}
Example1 expression
mconcat [ Product n | n <- [2 .. 10]]Product {getProduct = 3628800}

Constructors

Instances24Monad, Functor, MonadFix, Applicative, Foldable, Traversable, …
newtypenewtype Sum a
#

Monoid under addition.

Sum a <> Sum b = Sum (a + b)
Examples
Example1 expression
Sum 1 <> Sum 2 <> memptySum {getSum = 3}
Example1 expression
mconcat [ Sum n | n <- [3 .. 9]]Sum {getSum = 42}

Constructors

Instances24Monad, Functor, MonadFix, Applicative, Foldable, Traversable, …