Copyright | (c) Owen Bechtel 2023 |
---|---|
License | MIT |
Maintainer | [email protected] |
Stability | experimental |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Language.Change
Description
Synopsis
- data PSet a = PSet (Set a) Bool
- member :: Ord a => a -> PSet a -> Bool
- data Pattern a
- data Env a = Env [Pattern a] [Pattern a]
- testPatterns :: Ord a => [a] -> [Pattern a] -> Bool
- testEnv :: Ord a => [a] -> [a] -> Env a -> Bool
- newtype Change a = Change (Map a [([a], Env a)])
- applyChange :: Ord a => Change a -> [a] -> [a]
- applyChanges :: Ord a => [Change a] -> [a] -> [a]
- traceChanges :: Ord a => [Change a] -> [a] -> [[a]]
- replace :: ([a] -> a -> [a] -> [b]) -> [a] -> [b]
Phoneme sets
A finite set, or the complement of a finite set.
Environments
A single component of an Env
.
An environment in which a phoneme (or in general, a value of type a
), might occur.
An Env
is specified by two lists of patterns: the environment before the phoneme (ordered from nearest to farthest), and the environment after.
testPatterns :: Ord a => [a] -> [Pattern a] -> Bool Source #
Match a list of phonemes against a list of patterns.
Sound changes
A sound change.
applyChange :: Ord a => Change a -> [a] -> [a] Source #
Apply a sound change to a word.
applyChanges :: Ord a => [Change a] -> [a] -> [a] Source #
Apply a sequence of sound changes to a word, returning the final result.
traceChanges :: Ord a => [Change a] -> [a] -> [[a]] Source #
Apply a sequence of sound changes to a word, returning a list of intermediate results. (The first element of the list is the original word, and the last element is the result after applying all changes.)
replace :: ([a] -> a -> [a] -> [b]) -> [a] -> [b] Source #
A helper function used by applyChange
.
Similar to map
, except the first argument returns a list and has access to each element's environment.