phonetic-languages-constraints-array-0.6.2.0: Constraints to filter the needed permutations
Copyright(c) OleksandrZhabenko 2020-2023
LicenseMIT
Maintaineroleksandr.zhabenko@yahoo.com
StabilityExperimental
Safe HaskellSafe-Inferred
LanguageHaskell2010
Extensions
  • BangPatterns
  • TypeSynonymInstances
  • FlexibleContexts
  • FlexibleInstances

Phladiprelio.ConstraintsEncoded

Description

Provides a way to encode the needed constraint with possibly less symbols. Uses arrays instead of vectors.

Synopsis

Data types

data EncodedContraints a b Source #

Constructors

E 
P a b 
Q a a a a a 
T a a a a 
SA a a b 
SB a a b 
F a a a 
V a a a 
W a a a 
H a a a a 
R a a a a 
M a a a a 

Functions to work with them

Read functions

readMaybeECG :: 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. It is up to user to check whether the parameters are in the correct form, the function does not do the full checking.

Process-encoding functions

decodeConstraint1 :: (InsertLeft t (Array Int Int), Monoid (t (Array Int Int))) => EncodedCnstrs -> t (Array Int Int) -> t (Array Int Int) Source #

Must be applied to the correct array of permutation indeces. Otherwise, it gives runtime error (exception). All the integers inside the EncodedCnstrs must be in the range [0..n-1] where n corresponds to the maximum element in the permutation Array Int Int.

decodeLConstraints :: (InsertLeft t (Array Int Int), Monoid (t (Array Int Int))) => [EncodedCnstrs] -> t (Array Int Int) -> t (Array Int Int) Source #

Must be applied to the correct array of permutation indeces. Otherwise, it gives runtime error (exception). All the integers inside the EncodedCnstrs must be in the range [0..n-1] where n corresponds to the maximum element in the permutation Array Int Int.

Modifiers and getters

getIEl :: EncodedCnstrs -> Int Source #

Works only with the correctly defined argument though it is not checked. Use with this caution.

setIEl :: Int -> EncodedCnstrs -> EncodedCnstrs Source #

Works only with the correctly defined arguments though it is not checked. Use with this caution.

Predicates

Algebraic general conversion

validOrdStr :: String -> Bool Source #

An extended predicate to check whether the String is a probably correct representation of the constraints algebraic expression for generalConversion evaluation.

filterGeneralConv :: Int -> String -> [Array Int Int] -> [Array Int Int] Source #

Can be thought of as filter (generalConversion ... ) arrays but is somewhat more efficient.