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

Dep.Data.ThreeValue

Description

A module that defines three-value logic, for example used in thruth tables, Karnaugh cards, etc.

Synopsis

Define three-value logic

data ThreeValue Source #

A data type that is used if a value can present three logical values: don't care (or don't know); zero; and one.

Constructors

Zero

The value is zero or false.

One

The value is one or true.

DontCare

We do not care or do not know the value.

Instances

Instances details
Bounded ThreeValue Source # 
Instance details

Defined in Dep.Data.ThreeValue

Enum ThreeValue Source # 
Instance details

Defined in Dep.Data.ThreeValue

Eq ThreeValue Source # 
Instance details

Defined in Dep.Data.ThreeValue

Data ThreeValue Source # 
Instance details

Defined in Dep.Data.ThreeValue

Methods

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

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

toConstr :: ThreeValue -> Constr #

dataTypeOf :: ThreeValue -> DataType #

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

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

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

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

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

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

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

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

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

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

Ord ThreeValue Source # 
Instance details

Defined in Dep.Data.ThreeValue

Read ThreeValue Source # 
Instance details

Defined in Dep.Data.ThreeValue

Show ThreeValue Source # 
Instance details

Defined in Dep.Data.ThreeValue

Generic ThreeValue Source # 
Instance details

Defined in Dep.Data.ThreeValue

Associated Types

type Rep ThreeValue :: Type -> Type #

Semigroup ThreeValue Source # 
Instance details

Defined in Dep.Data.ThreeValue

Monoid ThreeValue Source # 
Instance details

Defined in Dep.Data.ThreeValue

Arbitrary ThreeValue Source # 
Instance details

Defined in Dep.Data.ThreeValue

Binary ThreeValue Source # 
Instance details

Defined in Dep.Data.ThreeValue

Default ThreeValue Source # 
Instance details

Defined in Dep.Data.ThreeValue

Methods

def :: ThreeValue #

NFData ThreeValue Source # 
Instance details

Defined in Dep.Data.ThreeValue

Methods

rnf :: ThreeValue -> () #

Hashable ThreeValue Source # 
Instance details

Defined in Dep.Data.ThreeValue

Mergeable ThreeValue Source # 
Instance details

Defined in Dep.Data.ThreeValue

Opposite ThreeValue Source # 
Instance details

Defined in Dep.Data.ThreeValue

Renderable ThreeValue Source # 
Instance details

Defined in Dep.Data.ThreeValue

CharRenderable ThreeValue Source # 
Instance details

Defined in Dep.Data.ThreeValue

Lift ThreeValue Source # 
Instance details

Defined in Dep.Data.ThreeValue

NonDeterministicWalkable Three ThreeValue Source # 
Instance details

Defined in Dep.Data.Three

ToCompact [ThreeValue] [Int] Source # 
Instance details

Defined in Dep.Data.LogicItem

type Rep ThreeValue Source # 
Instance details

Defined in Dep.Data.ThreeValue

type Rep ThreeValue = D1 ('MetaData "ThreeValue" "Dep.Data.ThreeValue" "dep-software-0.1.0.0-ImGw9o7wQ122cC0Rs2n7ZK" 'False) (C1 ('MetaCons "Zero" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "One" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "DontCare" 'PrefixI 'False) (U1 :: Type -> Type)))

Catamorphisms

threeValue Source #

Arguments

:: a

The value for DontCare.

-> a

The value for Zero.

-> a

The value for One.

-> ThreeValue

The value to convert to one of the given values.

-> a

The corresponding value.

Convert the given ThreeValue object to the corresponding value. This acts as a catamorphism for the ThreeValue type.

toMaybeBool Source #

Arguments

:: ThreeValue

The given ThreeValue to convert.

-> Maybe Bool

The corresponding Bool wrapped in a Maybe.

Convert the given ThreeValue to a Maybe Bool object. where DontCare is mapped to Nothing and Zero and One to True and False wrapped in a Just accordingly.

toChar Source #

Arguments

:: ThreeValue

The given ThreeValue object to map.

-> Char

The corresponding Char that presents the ThreeValue.

Convert the given ThreeValue to a Char that presents the given value. DontCare is mapped to -; Zero to 0; and One to 1.

Convert to and from a ThreeValue

fromBool Source #

Arguments

:: Bool

The given Bool to convert tot a ThreeValue.

-> ThreeValue

The corresponding ThreeValue object.

Convert True and False to Zero and One respectively.

fromMaybeBool Source #

Arguments

:: Maybe Bool

The given Bool object to convert.

-> ThreeValue

The corresponding object where Nothing is mapped to DontCare, and True and False are mapped to One and Zero respectively.

Convert a Maybe Bool to a ThreeValue, where Nothing is mapped to DontCare, and Just True and Just False to One and Zero.

toUpper :: ThreeValue -> Bool Source #

A function that maps Ones and DontCares to Trues; and Zeros to False.

toLower :: ThreeValue -> Bool Source #

A function that maps Zeros and DontCares to Falses; and Ones to True.

Operators on ThreeValue

opposite Source #

Arguments

:: Opposite a 
=> a

The given item to determine the opposite from.

-> a

The opposite of the given value.

A function that determines the opposite value.

Type aliasses

type ThreeValues = [ThreeValue] Source #

A type alias for a list of ThreeValue objects.

parseThreeValue :: Stream s m Char => ParsecT s u m ThreeValue Source #

A parser that can parse a single ThreeValue from a Character. The characters for Zero are 0, f or F; the characters for Zero are 1, t or T; and the characters for DontCare are -, d or D,

parseThreeValues :: Stream s m Char => ParsecT s u m ThreeValues Source #

A parser that can parse a (possibly empty) list of ThreeValue from a Character. The characters for Zero are 0, f or F; the characters for Zero are 1, t or T; and the characters for DontCare are -, d or D,

parseThreeValues1 :: Stream s m Char => ParsecT s u m (NonEmpty ThreeValue) Source #

A parser that can parse a NonEmpty list of ThreeValue from a Character. The characters for Zero are 0, f or F; the characters for Zero are 1, t or T; and the characters for DontCare are -, d or D,