| Copyright | (c) 2020 Reed Mullanix Emily Pillmore |
|---|---|
| License | BSD-style |
| Maintainer | Reed Mullanix <reedmullanix@gmail.com>, Emily Pillmore <emilypi@cohomolo.gy> |
| Stability | stable |
| Portability | non-portable |
| Safe Haskell | Safe |
| Language | Haskell2010 |
Data.Group.Free.Church
Contents
Description
This module provides definitions for Church-encoded
FreeGroups, FreeAbelianGroups, along with useful combinators.
Synopsis
- newtype FG a = FG {}
- interpretFG :: Group g => FG g -> g
- reifyFG :: FG a -> FreeGroup a
- reflectFG :: FreeGroup a -> FG a
- presentFG :: Group g => FG g -> (FG g -> g) -> g
- newtype FA a = FA {}
- forgetFA :: Ord a => FA a -> FG a
- interpretFA :: Abelian g => FA g -> g
- reifyFA :: Ord a => FA a -> FreeAbelianGroup a
- reflectFA :: FreeAbelianGroup a -> FA a
Church-encoded free groups
The Church-encoding of a FreeGroup.
This datatype represents the "true" free group in Haskell on some a-valued
generators. For more information on why this encoding is preferred,
see Dan Doel's article in
the Comonad Reader.
While FreeGroup et al are free in a strict language, and are more intuitive,
they are not associative wtih respect to bottoms. FG and FA however, are,
and should be preferred when working with possibly undefined data.
Church-encoded free group combinators
interpretFG :: Group g => FG g -> g Source #
Interpret a Church-encoded free group as a concrete FreeGroup.
reflectFG :: FreeGroup a -> FG a Source #
Convert a concrete FreeGroup to a Church-encoded free group.
Church-encoded free abelian groups
The Church-encoding of a FreeAbelianGroup.
This datatype represents the free group on some a-valued
generators, along with their exponents in the group.
Church-encoded free abelian group combinators
forgetFA :: Ord a => FA a -> FG a Source #
Forget the commutative structure of a Church-encoded free abelian group, turning it into a standard free group.
interpretFA :: Abelian g => FA g -> g Source #
Interpret a Church-encoded free abelian group as a concrete FreeAbelianGroup.
reifyFA :: Ord a => FA a -> FreeAbelianGroup a Source #
Convert a Church-encoded free abelian group to a concrete FreeAbelianGroup.
reflectFA :: FreeAbelianGroup a -> FA a Source #
Convert a concrete FreeAbelianGroup to a Church-encoded free abelian group.