nonfree-0.1.0.0: Free structures sans laws

Safe HaskellSafe-Inferred

Data.Monoid.Nonfree

Synopsis

Documentation

data N a Source

Nonfree nonmonoid.

Constructors

N a 
NEmpty 
NAppend (N a) (N a) 

Instances

Functor N 
Foldable N 
Traversable N 
Show a => Show (N a)

The Show instance uses short names to make the append trees readable.

Monoid (N a) 

(◇) :: Monoid m => m -> m -> mSource

A synonym for mappend (<>).

ε :: Monoid m => mSource

A synonym for mempty.

toN :: Foldable t => t a -> N aSource

A version of toList that extracts the full monoid append tree rather than flattening it to a list.

fromN :: Traversable t => N b -> t a -> t bSource

Given a monoid append tree and a Traversable structure with exactly the same shape, put values from the former into the latter. This will fail with an error if the structure isn't identical.