basesystems
Safe HaskellSafe-Inferred
LanguageGHC2021

Data.BaseSystem.Alphabet

Description

Implements digit alphabets for BaseSystems.

Synopsis

Documentation

type Symbol = Text Source #

Represents a symbol to act as a digit in a numbering system.

type Value = Integer Source #

The value of a symbol in a number system.

data Alphabet Source #

Represents a two-way mapping between symbol's values and values's symbols.

Instances

Instances details
Eq Alphabet Source # 
Instance details

Defined in Data.BaseSystem.Alphabet

Ord Alphabet Source # 
Instance details

Defined in Data.BaseSystem.Alphabet

mkAlphabet :: String -> Alphabet Source #

Creates an Alphabet from a given String by chunking the single unicode points into Symbols.

resolveValue :: Alphabet -> Symbol -> Maybe Value Source #

O(log n) Find a value from a symbol in an alphabet.

resolveSymbol :: Alphabet -> Value -> Maybe Symbol Source #

O(1) Find a symbol from a value in an alphabet.