dep-software-0.1.0.0
Maintainerhapytexeu+gh@gmail.com
Stabilityexperimental
PortabilityPOSIX
Safe HaskellSafe
LanguageHaskell2010

Dep.Data.Sum

Description

This module provides utility functions to compress/decompress sums, and render these Product's to a unicode string.

Synopsis

Type synonyms to represent synthesis

newtype Sum Source #

A data type that can be used to specify a sum. By using a newtype, we can add special instance to the Sum.

Constructors

Sum Sum' 

Instances

Instances details
Eq Sum Source # 
Instance details

Defined in Dep.Data.Sum

Methods

(==) :: Sum -> Sum -> Bool #

(/=) :: Sum -> Sum -> Bool #

Data Sum Source # 
Instance details

Defined in Dep.Data.Sum

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Sum -> c Sum #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Sum #

toConstr :: Sum -> Constr #

dataTypeOf :: Sum -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Sum) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Sum) #

gmapT :: (forall b. Data b => b -> b) -> Sum -> Sum #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Sum -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Sum -> r #

gmapQ :: (forall d. Data d => d -> u) -> Sum -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Sum -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Sum -> m Sum #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Sum -> m Sum #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Sum -> m Sum #

Ord Sum Source # 
Instance details

Defined in Dep.Data.Sum

Methods

compare :: Sum -> Sum -> Ordering #

(<) :: Sum -> Sum -> Bool #

(<=) :: Sum -> Sum -> Bool #

(>) :: Sum -> Sum -> Bool #

(>=) :: Sum -> Sum -> Bool #

max :: Sum -> Sum -> Sum #

min :: Sum -> Sum -> Sum #

Read Sum Source # 
Instance details

Defined in Dep.Data.Sum

Show Sum Source # 
Instance details

Defined in Dep.Data.Sum

Methods

showsPrec :: Int -> Sum -> ShowS #

show :: Sum -> String #

showList :: [Sum] -> ShowS #

Generic Sum Source # 
Instance details

Defined in Dep.Data.Sum

Associated Types

type Rep Sum :: Type -> Type #

Methods

from :: Sum -> Rep Sum x #

to :: Rep Sum x -> Sum #

Arbitrary Sum Source # 
Instance details

Defined in Dep.Data.Sum

Methods

arbitrary :: Gen Sum #

shrink :: Sum -> [Sum] #

Binary Sum Source # 
Instance details

Defined in Dep.Data.Sum

Methods

put :: Sum -> Put #

get :: Get Sum #

putList :: [Sum] -> Put #

NFData Sum Source # 
Instance details

Defined in Dep.Data.Sum

Methods

rnf :: Sum -> () #

Hashable Sum Source # 
Instance details

Defined in Dep.Data.Sum

Methods

hashWithSalt :: Int -> Sum -> Int #

hash :: Sum -> Int #

EvaluateItem Sum Source # 
Instance details

Defined in Dep.Data.Sum

ToCompact Sum CompactSum Source # 
Instance details

Defined in Dep.Data.Sum

type Rep Sum Source # 
Instance details

Defined in Dep.Data.Sum

type Rep Sum = D1 ('MetaData "Sum" "Dep.Data.Sum" "dep-software-0.1.0.0-ImGw9o7wQ122cC0Rs2n7ZK" 'True) (C1 ('MetaCons "Sum" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Sum')))

type Sum' = ThreePath Source #

A type alias for a sum that is a ThreePath.

newtype CompactSum Source #

A data type that can be used to specify a CompactSum. By using a new type, this means that we can define other instances than these for a list of Int.

Constructors

CompactSum CompactSum' 

Instances

Instances details
Eq CompactSum Source # 
Instance details

Defined in Dep.Data.Sum

Data CompactSum Source # 
Instance details

Defined in Dep.Data.Sum

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> CompactSum -> c CompactSum #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c CompactSum #

toConstr :: CompactSum -> Constr #

dataTypeOf :: CompactSum -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c CompactSum) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CompactSum) #

gmapT :: (forall b. Data b => b -> b) -> CompactSum -> CompactSum #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> CompactSum -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> CompactSum -> r #

gmapQ :: (forall d. Data d => d -> u) -> CompactSum -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> CompactSum -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> CompactSum -> m CompactSum #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> CompactSum -> m CompactSum #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> CompactSum -> m CompactSum #

Ord CompactSum Source # 
Instance details

Defined in Dep.Data.Sum

Read CompactSum Source # 
Instance details

Defined in Dep.Data.Sum

Show CompactSum Source # 
Instance details

Defined in Dep.Data.Sum

Generic CompactSum Source # 
Instance details

Defined in Dep.Data.Sum

Associated Types

type Rep CompactSum :: Type -> Type #

Arbitrary CompactSum Source # 
Instance details

Defined in Dep.Data.Sum

Binary CompactSum Source # 
Instance details

Defined in Dep.Data.Sum

NFData CompactSum Source # 
Instance details

Defined in Dep.Data.Sum

Methods

rnf :: CompactSum -> () #

Hashable CompactSum Source # 
Instance details

Defined in Dep.Data.Sum

EvaluateItem CompactSum Source # 
Instance details

Defined in Dep.Data.Sum

ToCompact Sum CompactSum Source # 
Instance details

Defined in Dep.Data.Sum

type Rep CompactSum Source # 
Instance details

Defined in Dep.Data.Sum

type Rep CompactSum = D1 ('MetaData "CompactSum" "Dep.Data.Sum" "dep-software-0.1.0.0-ImGw9o7wQ122cC0Rs2n7ZK" 'True) (C1 ('MetaCons "CompactSum" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 CompactSum')))

type CompactSum' = [Int] Source #

A more compact representation of a sum where the indexes that have Zero or One are listed by the positive or negative index respectively.

newtype ProductOfSums Source #

A data type that is used to specify a product of sums. This type can be used to specify new instance other than these of a list of lists of Ints.

Constructors

ProductOfSums [Sum] 

Instances

Instances details
Eq ProductOfSums Source # 
Instance details

Defined in Dep.Data.Sum

Data ProductOfSums Source # 
Instance details

Defined in Dep.Data.Sum

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ProductOfSums -> c ProductOfSums #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c ProductOfSums #

toConstr :: ProductOfSums -> Constr #

dataTypeOf :: ProductOfSums -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c ProductOfSums) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ProductOfSums) #

gmapT :: (forall b. Data b => b -> b) -> ProductOfSums -> ProductOfSums #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ProductOfSums -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ProductOfSums -> r #

gmapQ :: (forall d. Data d => d -> u) -> ProductOfSums -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> ProductOfSums -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> ProductOfSums -> m ProductOfSums #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ProductOfSums -> m ProductOfSums #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ProductOfSums -> m ProductOfSums #

Ord ProductOfSums Source # 
Instance details

Defined in Dep.Data.Sum

Read ProductOfSums Source # 
Instance details

Defined in Dep.Data.Sum

Show ProductOfSums Source # 
Instance details

Defined in Dep.Data.Sum

Generic ProductOfSums Source # 
Instance details

Defined in Dep.Data.Sum

Associated Types

type Rep ProductOfSums :: Type -> Type #

Semigroup ProductOfSums Source # 
Instance details

Defined in Dep.Data.Sum

Monoid ProductOfSums Source # 
Instance details

Defined in Dep.Data.Sum

Arbitrary ProductOfSums Source # 
Instance details

Defined in Dep.Data.Sum

Binary ProductOfSums Source # 
Instance details

Defined in Dep.Data.Sum

NFData ProductOfSums Source # 
Instance details

Defined in Dep.Data.Sum

Methods

rnf :: ProductOfSums -> () #

Hashable ProductOfSums Source # 
Instance details

Defined in Dep.Data.Sum

EvaluateItem ProductOfSums Source # 
Instance details

Defined in Dep.Data.Sum

type Rep ProductOfSums Source # 
Instance details

Defined in Dep.Data.Sum

type Rep ProductOfSums = D1 ('MetaData "ProductOfSums" "Dep.Data.Sum" "dep-software-0.1.0.0-ImGw9o7wQ122cC0Rs2n7ZK" 'True) (C1 ('MetaCons "ProductOfSums" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Sum])))

type ProductOfSums' = [Sum'] Source #

A type synonym to present a product of sums where each item of the list is a Sum'.

Print sums and product of sums

showProductOfSums Source #

Arguments

:: Char

The name of the root variable that will be used with subscripts.

-> ProductOfSums'

The given sum of products to convert to a Text.

-> Text

The corresponding Text object that presents the given ProductOfSums'.

Convert the given product of sums to a Text object that presents the ProductOfSums' as a Text object with variables as subscript.

>>> showProductOfSums 'x' [[One, One], [DontCare, Zero, One]]
"(x₀x₁)(x₁'x₂)"

showSum Source #

Arguments

:: Char

The name of the root variable that will be used with subscripts.

-> Sum'

The given sum to convert to a Text.

-> Text

The corresponding Text object that presents the given Product'.

Print a given sum as a sequence of variables that can be negated. for example:

>>> showSum 'x' [One, DontCare, Zero, One]
"x₀ + x₂' + x₃"

showSum' Source #

Arguments

:: Char

The name of the root variable that will be used with subscripts.

-> Text

The text that will be added as tail, this is useful if we combine Sums.

-> Sum'

The given sum to convert to a Text.

-> Text

The corresponding Text object that presents the given Sum'.

Print a given sum as a sequence of variables that can be negated. for example:

>>> showSum' 'x' mempty [One, DontCare, Zero, One]
"x₀ + x₂' + x₃"