Copyright | (c) 2020 Emily Pillmore |
---|---|
License | BSD-style |
Maintainer | Emily Pillmore <emilypi@cohomolo.gy>, Reed Mullanix <reedmullanix@gmail.com> |
Stability | stable |
Portability | non-portable |
Safe Haskell | Safe |
Language | Haskell2010 |
This module contains definitions for CyclicGroup
along with the relevant combinators.
Synopsis
- class Group g => CyclicGroup g where
- generator :: g
- generate :: (Eq a, CyclicGroup a) => [a]
- classify :: (Eq a, CyclicGroup a) => (a -> Bool) -> [a]
Cyclic groups
class Group g => CyclicGroup g where Source #
A CyclicGroup
is a Group
that is generated by a single element.
This element is called a generator of the group. There can be many
generators for a group, e.g., any representative of an equivalence
class of prime numbers of the integers modulo n
, but to make things
easy, we ask for only one generator.
Instances
Combinators
generate :: (Eq a, CyclicGroup a) => [a] Source #
Lazily generate all elements of a CyclicGroup
from its generator.
Note: fuses.
classify :: (Eq a, CyclicGroup a) => (a -> Bool) -> [a] Source #
Classify elements of a CyclicGroup
.
Apply a classifying function a -> Bool
to the elements
of a CyclicGroup
as generated by its designated generator.
Examples:
>>>
classify (< (3 :: Sum Word8))
[Sum {getSum = 1},Sum {getSum = 2}]