| Copyright | (c) 2020 Reed Mullanix Emily Pillmore Koji Miyazato |
|---|---|
| License | BSD-style |
| Maintainer | Reed Mullanix <reedmullanix@gmail.com>, Emily Pillmore <emilypi@cohomolo.gy> |
| Stability | stable |
| Portability | non-portable |
| Safe Haskell | Unsafe |
| Language | Haskell2010 |
Data.Group.Free.Internal
Contents
Description
This module exposes internals of FreeAbelianGroup.
Synopsis
- newtype FreeAbelianGroup a = MkFreeAbelianGroup (Map a Integer)
Free abelian groups
newtype FreeAbelianGroup a Source #
A representation of a free abelian group over an alphabet a.
The intuition here is group elements correspond with their positive or negative multiplicities, and as such are simplified by construction.
Examples:
>>>let single a = MkFreeAbelianGroup $ Map.singleton a 1>>>a = single 'a'>>>b = single 'b'>>>aFreeAbelianGroup $ fromList [('a',1)]>>>a <> bFreeAbelianGroup $ fromList [('a',1),('b',1)]>>>a <> b == b <> aTrue>>>invert aFreeAbelianGroup $ fromList [('a',-1)]>>>a <> b <> invert aFreeAbelianGroup $ fromList [('b',1)]>>>gtimes 5 (a <> b)FreeAbelianGroup $ fromList [('a',5),('b',5)]
Constructors
| MkFreeAbelianGroup (Map a Integer) | Unsafe "raw" constructor, which does not do normalization work.
Please use |