| Copyright | (c) OleksandrZhabenko 2020 |
|---|---|
| License | MIT |
| Maintainer | olexandr543@yahoo.com |
| Stability | Experimental |
| Safe Haskell | None |
| Language | Haskell2010 |
Languages.UniquenessPeriods.Vector.ConstraintsG.Encoded
Description
Provides a way to encode the needed constraint with possibly less symbols.
Synopsis
- data EncodedContraints a b
- type EncodedCnstrs = EncodedContraints Int (Vector Int)
- readMaybeEC :: Int -> String -> Maybe EncodedCnstrs
- readMaybeECG :: Int -> String -> Maybe EncodedCnstrs
- decodeConstraint1 :: EncodedCnstrs -> Vector (Vector Int) -> Vector (Vector Int)
- decodeLConstraints :: [EncodedCnstrs] -> Vector (Vector Int) -> Vector (Vector Int)
- getIEl :: EncodedCnstrs -> Int
- setIEl :: Int -> EncodedCnstrs -> EncodedCnstrs
- isE :: EncodedCnstrs -> Bool
- isF :: EncodedCnstrs -> Bool
- isQ :: EncodedCnstrs -> Bool
- isT :: EncodedCnstrs -> Bool
- isSA :: EncodedCnstrs -> Bool
- isSB :: EncodedCnstrs -> Bool
Data types
data EncodedContraints a b Source #
Instances
| (Eq a, Eq b) => Eq (EncodedContraints a b) Source # | |
Defined in Languages.UniquenessPeriods.Vector.ConstraintsG.Encoded Methods (==) :: EncodedContraints a b -> EncodedContraints a b -> Bool # (/=) :: EncodedContraints a b -> EncodedContraints a b -> Bool # | |
| (Ord a, Ord b) => Ord (EncodedContraints a b) Source # | |
Defined in Languages.UniquenessPeriods.Vector.ConstraintsG.Encoded Methods compare :: EncodedContraints a b -> EncodedContraints a b -> Ordering # (<) :: EncodedContraints a b -> EncodedContraints a b -> Bool # (<=) :: EncodedContraints a b -> EncodedContraints a b -> Bool # (>) :: EncodedContraints a b -> EncodedContraints a b -> Bool # (>=) :: EncodedContraints a b -> EncodedContraints a b -> Bool # max :: EncodedContraints a b -> EncodedContraints a b -> EncodedContraints a b # min :: EncodedContraints a b -> EncodedContraints a b -> EncodedContraints a b # | |
type EncodedCnstrs = EncodedContraints Int (Vector Int) Source #
Functions to work with them
Read functions
readMaybeEC :: Int -> String -> Maybe EncodedCnstrs Source #
Inspired by the: https://hackage.haskell.org/package/base-4.14.0.0/docs/Data-Maybe.html
Is provided here as a more general way to read the String into a EncodedCnstrs than more restricted
but safer readMaybeECG. It is up to user to check whether the parameters are in the correct form, the function does
not do the full checking. For phonetic-languages applications, it is better to use readMaybeECG function instead.
readMaybeECG :: Int -> String -> Maybe EncodedCnstrs Source #
A safer variant of the readMaybeEC more suitable for applications, e. g. for phonetic-languages series of packages.
Process-encoding functions
decodeConstraint1 :: EncodedCnstrs -> Vector (Vector Int) -> Vector (Vector Int) Source #
Must be applied to the correct vector of permutation indeces. Otherwise, it gives runtime error (exception). All the integers inside the
EncodedCnstrs must be in the range [0..n] where n corresponds to the maximum element in the permutation Vector Int. Besides,
n is (probably must be) not greater than 6.
decodeLConstraints :: [EncodedCnstrs] -> Vector (Vector Int) -> Vector (Vector Int) Source #
Must be applied to the correct vector of permutation indeces. Otherwise, it gives runtime error (exception). All the integers inside the
EncodedCnstrs must be in the range [0..n] where n corresponds to the maximum element in the permutation Vector Int. Besides,
n is (probably must be) not greater than 6.
Modifiers and getters
getIEl :: EncodedCnstrs -> Int Source #
setIEl :: Int -> EncodedCnstrs -> EncodedCnstrs Source #
Predicates
isE :: EncodedCnstrs -> Bool Source #
isF :: EncodedCnstrs -> Bool Source #
isQ :: EncodedCnstrs -> Bool Source #
isT :: EncodedCnstrs -> Bool Source #
isSA :: EncodedCnstrs -> Bool Source #
isSB :: EncodedCnstrs -> Bool Source #