funcons-values-0.1.0.7: Library providing values and operations on values in a fixed universe.

Safe HaskellNone
LanguageHaskell2010

Funcons.Operations

Synopsis

Documentation

atom_ :: HasValues t => [OpExpr t] -> OpExpr t Source #

adts_ :: HasValues t => [OpExpr t] -> OpExpr t Source #

type OP = String Source #

data Result t Source #

Instances
Monad Result Source # 
Instance details

Defined in Funcons.Operations.Expr

Methods

(>>=) :: Result a -> (a -> Result b) -> Result b #

(>>) :: Result a -> Result b -> Result b #

return :: a -> Result a #

fail :: String -> Result a #

Functor Result Source # 
Instance details

Defined in Funcons.Operations.Expr

Methods

fmap :: (a -> b) -> Result a -> Result b #

(<$) :: a -> Result b -> Result a #

Applicative Result Source # 
Instance details

Defined in Funcons.Operations.Expr

Methods

pure :: a -> Result a #

(<*>) :: Result (a -> b) -> Result a -> Result b #

liftA2 :: (a -> b -> c) -> Result a -> Result b -> Result c #

(*>) :: Result a -> Result b -> Result b #

(<*) :: Result a -> Result b -> Result a #

Show t => Show (Result t) Source # 
Instance details

Defined in Funcons.Operations.Expr

Methods

showsPrec :: Int -> Result t -> ShowS #

show :: Result t -> String #

showList :: [Result t] -> ShowS #

type UnaryOp t = t -> Result t Source #

type BinaryOp t = t -> t -> Result t Source #

type TernaryOp t = t -> t -> t -> Result t Source #

type NaryOp t = [t] -> Result t Source #

type UnaryVOp t = Values t -> Result t Source #

type BinaryVOp t = Values t -> Values t -> Result t Source #

type TernaryVOp t = Values t -> Values t -> Values t -> Result t Source #

type NaryVOp t = [Values t] -> Result t Source #

data OpExpr t Source #

Instances
(HasValues t, Show t) => Show (OpExpr t) Source # 
Instance details

Defined in Funcons.Operations.Eval

Methods

showsPrec :: Int -> OpExpr t -> ShowS #

show :: OpExpr t -> String #

showList :: [OpExpr t] -> ShowS #

vBinaryOp :: HasValues t => OP -> BinaryVOp t -> OpExpr t -> OpExpr t -> OpExpr t Source #

vTernaryOp :: HasValues t => OP -> TernaryVOp t -> OpExpr t -> OpExpr t -> OpExpr t -> OpExpr t Source #

vNaryOp :: HasValues t => OP -> NaryVOp t -> [OpExpr t] -> OpExpr t Source #

type UnaryExpr t = OpExpr t -> OpExpr t Source #

type BinaryExpr t = OpExpr t -> OpExpr t -> OpExpr t Source #

type TernaryExpr t = OpExpr t -> OpExpr t -> OpExpr t -> OpExpr t Source #

type NaryExpr t = [OpExpr t] -> OpExpr t Source #

arityErr :: Int -> OP -> [OpExpr t] -> OpExpr t Source #

data IEEEFormats Source #

Constructors

Binary32 
Binary64 

class HasTypes t where Source #

Methods

projectT :: t -> Maybe (Types t) Source #

injectT :: Types t -> t Source #

Instances
HasComputationTypes t => HasTypes t Source # 
Instance details

Defined in Funcons.Operations.Values

Methods

projectT :: t -> Maybe (Types t) Source #

injectT :: Types t -> t Source #

class HasValues t where Source #

Methods

project :: t -> Maybe (Values t) Source #

inject :: Values t -> t Source #

data Types t Source #

Representation of builtin types.

Instances
Functor Types Source # 
Instance details

Defined in Funcons.Operations.Values

Methods

fmap :: (a -> b) -> Types a -> Types b #

(<$) :: a -> Types b -> Types a #

Foldable Types Source # 
Instance details

Defined in Funcons.Operations.Values

Methods

fold :: Monoid m => Types m -> m #

foldMap :: Monoid m => (a -> m) -> Types a -> m #

foldr :: (a -> b -> b) -> b -> Types a -> b #

foldr' :: (a -> b -> b) -> b -> Types a -> b #

foldl :: (b -> a -> b) -> b -> Types a -> b #

foldl' :: (b -> a -> b) -> b -> Types a -> b #

foldr1 :: (a -> a -> a) -> Types a -> a #

foldl1 :: (a -> a -> a) -> Types a -> a #

toList :: Types a -> [a] #

null :: Types a -> Bool #

length :: Types a -> Int #

elem :: Eq a => a -> Types a -> Bool #

maximum :: Ord a => Types a -> a #

minimum :: Ord a => Types a -> a #

sum :: Num a => Types a -> a #

product :: Num a => Types a -> a #

Traversable Types Source # 
Instance details

Defined in Funcons.Operations.Values

Methods

traverse :: Applicative f => (a -> f b) -> Types a -> f (Types b) #

sequenceA :: Applicative f => Types (f a) -> f (Types a) #

mapM :: Monad m => (a -> m b) -> Types a -> m (Types b) #

sequence :: Monad m => Types (m a) -> m (Types a) #

Eq t => Eq (Types t) Source # 
Instance details

Defined in Funcons.Operations.Values

Methods

(==) :: Types t -> Types t -> Bool #

(/=) :: Types t -> Types t -> Bool #

Ord t => Ord (Types t) Source # 
Instance details

Defined in Funcons.Operations.Values

Methods

compare :: Types t -> Types t -> Ordering #

(<) :: Types t -> Types t -> Bool #

(<=) :: Types t -> Types t -> Bool #

(>) :: Types t -> Types t -> Bool #

(>=) :: Types t -> Types t -> Bool #

max :: Types t -> Types t -> Types t #

min :: Types t -> Types t -> Types t #

Read t => Read (Types t) Source # 
Instance details

Defined in Funcons.Operations.Values

Show t => Show (Types t) Source # 
Instance details

Defined in Funcons.Operations.Values

Methods

showsPrec :: Int -> Types t -> ShowS #

show :: Types t -> String #

showList :: [Types t] -> ShowS #

data ComputationTypes t Source #

Computation type S=>T reflects a type of term whose given value is of type S and result is of type T.

Constructors

Type (Types t) 
ComputesType (Types t)

=>T

ComputesFromType (Types t) (Types t)

S=>T

Instances
Functor ComputationTypes Source # 
Instance details

Defined in Funcons.Operations.Values

Methods

fmap :: (a -> b) -> ComputationTypes a -> ComputationTypes b #

(<$) :: a -> ComputationTypes b -> ComputationTypes a #

Eq t => Eq (ComputationTypes t) Source # 
Instance details

Defined in Funcons.Operations.Values

Ord t => Ord (ComputationTypes t) Source # 
Instance details

Defined in Funcons.Operations.Values

Read t => Read (ComputationTypes t) Source # 
Instance details

Defined in Funcons.Operations.Values

Show t => Show (ComputationTypes t) Source # 
Instance details

Defined in Funcons.Operations.Values

type ValueSets t = Set t Source #

type ValueMaps t = Map t [t] Source #

data Values t Source #

This datatype provides a number of builtin value types. The type t is expected to be a super-type of `Values t`, such that there is a projection and injection between t and `Values t`, (see HasValues)

Instances
Eq t => Eq (Values t) Source # 
Instance details

Defined in Funcons.Operations.Values

Methods

(==) :: Values t -> Values t -> Bool #

(/=) :: Values t -> Values t -> Bool #

Ord t => Ord (Values t) Source # 
Instance details

Defined in Funcons.Operations.Values

Methods

compare :: Values t -> Values t -> Ordering #

(<) :: Values t -> Values t -> Bool #

(<=) :: Values t -> Values t -> Bool #

(>) :: Values t -> Values t -> Bool #

(>=) :: Values t -> Values t -> Bool #

max :: Values t -> Values t -> Values t #

min :: Values t -> Values t -> Values t #

(Read t, Ord t) => Read (Values t) Source # 
Instance details

Defined in Funcons.Operations.Values

Show t => Show (Values t) Source # 
Instance details

Defined in Funcons.Operations.Values

Methods

showsPrec :: Int -> Values t -> ShowS #

show :: Values t -> String #

showList :: [Values t] -> ShowS #

HasValues t => IsString (Values t) Source # 
Instance details

Defined in Funcons.Operations.Values

Methods

fromString :: String -> Values t #

type Name = Text Source #

tuple :: HasValues t => [Values t] -> Values t Source #

list :: HasValues t => [Values t] -> Values t Source #

multi :: HasValues t => [t] -> Values t Source #

sets :: HasValues t => Types t -> Types t Source #

maps :: HasValues t => t -> t -> Types t Source #

vmap :: Ord b => (a -> b) -> Values a -> Values b Source #

traverseV :: (Ord b, Monad m, HasValues a, HasValues b) => (a -> m b) -> Values a -> m (Values b) Source #

traverseVM :: (Ord b, Monad m, HasValues a, HasValues b) => (a -> m b) -> ([a] -> m [b]) -> Values a -> m (Values b) Source #

traverseT :: (Ord b, Monad m, HasValues a, HasValues b) => (a -> m b) -> Types a -> m (Types b) Source #

traverseTM :: (Ord b, Monad m, HasValues a, HasValues b) => (a -> m b) -> ([a] -> m [b]) -> Types a -> m (Types b) Source #

traverseCTM :: (Ord b, Monad m, HasValues a, HasValues b) => (a -> m b) -> ([a] -> m [b]) -> ComputationTypes a -> m (ComputationTypes b) Source #

structVcompare :: (Monoid m, HasValues a, HasValues b) => (a -> b -> Maybe m) -> Values a -> Values b -> Maybe (Maybe m) Source #

structCTMcompare :: (Monoid m, HasValues a, HasValues b) => (a -> b -> Maybe m) -> ([a] -> [b] -> Maybe m) -> ComputationTypes a -> ComputationTypes b -> Maybe (Maybe m) Source #

structVMcompare :: (Monoid m, HasValues b, HasValues a) => (a -> b -> Maybe m) -> ([a] -> [b] -> Maybe m) -> Values a -> Values b -> Maybe (Maybe m) Source #

structTMcompare :: (Monoid m, HasValues a, HasValues b) => (a -> b -> Maybe m) -> ([a] -> [b] -> Maybe m) -> Types a -> Types b -> Maybe (Maybe m) Source #

upcastRationals :: Values t -> Values t Source #

Returns the rational representation of a value if it is a subtype. Otherwise it returns the original value.

upcastIntegers :: Values t -> Values t Source #

Returns the integer representation of a value if it is a subtype. Otherwise it returns the original value.

upcastNaturals :: Values t -> Values t Source #

Returns the natural representation of a value if it is a subtype. Otherwise it returns the original value.

downcast_unicode_characters :: HasValues t => Char -> Values t Source #

Checks whetDoes not check whether the `unicode-point` of

(===) :: (HasValues t, Eq t) => Values t -> Values t -> Bool Source #

(=/=) :: (HasValues t, Eq t) => Values t -> Values t -> Bool Source #

ppValues :: HasValues t => (t -> String) -> Values t -> String Source #

ppTypes :: HasValues t => (t -> String) -> Types t -> String Source #

data EvalResult t Source #

Constructors

Error (OpExpr t) (Result t) 
Success t 
Instances
(HasValues t, Show t) => Show (EvalResult t) Source # 
Instance details

Defined in Funcons.Operations.Eval

nil_ :: HasValues t => [OpExpr t] -> OpExpr t Source #

cons_ :: HasValues t => [OpExpr t] -> OpExpr t Source #

cons :: HasValues t => OpExpr t -> OpExpr t -> OpExpr t Source #

list_ :: HasValues t => [OpExpr t] -> OpExpr t Source #

head_ :: HasValues t => [OpExpr t] -> OpExpr t Source #

tail_ :: HasValues t => [OpExpr t] -> OpExpr t Source #

is_equal_ :: (HasValues t, Eq t) => [OpExpr t] -> OpExpr t Source #

is_equal :: (HasValues t, Eq t) => OpExpr t -> OpExpr t -> OpExpr t Source #

some__ :: HasValues t => t -> Values t Source #

some_ :: HasValues t => [OpExpr t] -> OpExpr t Source #

none_ :: HasValues t => [OpExpr t] -> OpExpr t Source #

null_ :: HasValues t => [OpExpr t] -> OpExpr t Source #

type_member :: HasValues t => OpExpr t -> OpExpr t -> OpExpr t Source #

Type membership check for primitive types and predefined composite types (non-ADTs).

type Graph e = Map e (Set e) Source #

is_cyclic_ :: (Ord t, HasValues t) => [OpExpr t] -> OpExpr t Source #

toGraph :: Ord t => Values t -> Maybe (Graph (Values t)) Source #

entries :: Eq e => Graph e -> [e] Source #

Get the entry points of the graph

delete :: Ord e => e -> Graph e -> Graph e Source #

Delete a node from the graph

schedule :: Ord e => Graph e -> ([e], Graph e) Source #

Return all nodes in the graph such that if `a -> b` in the graph then a occurs before b in the result Also returns a graph which, if cyclic, contains all the cycles in the original graph, corresponding to nodes not in the schedule.

cyclic :: Ord e => Graph e -> Bool Source #

Checks whether the given grammar contains cycles

is_empty :: Map k a -> Bool Source #

Checks whether the given graph is empty

sets_ :: HasValues t => [OpExpr t] -> OpExpr t Source #

is_in_set_ :: (HasValues t, Ord t) => [OpExpr t] -> OpExpr t Source #

is_in_set :: (HasValues t, Ord t) => OpExpr t -> OpExpr t -> OpExpr t Source #

set_size_ :: (Ord t, HasValues t) => [OpExpr t] -> OpExpr t Source #

set_size :: (Ord t, HasValues t) => OpExpr t -> OpExpr t Source #

is_subset_ :: (Ord t, HasValues t) => [OpExpr t] -> OpExpr t Source #

is_subset :: (Ord t, HasValues t) => OpExpr t -> OpExpr t -> OpExpr t Source #

set_ :: (Ord t, HasValues t) => [OpExpr t] -> OpExpr t Source #

set_unite_ :: (Ord t, HasValues t) => [OpExpr t] -> OpExpr t Source #

set_insert_ :: (Ord t, HasValues t) => [OpExpr t] -> OpExpr t Source #

set_insert :: (HasValues t, Ord t) => OpExpr t -> OpExpr t -> OpExpr t Source #

multiset_ :: (Ord t, HasValues t) => [OpExpr t] -> OpExpr t Source #

apply_to_vec :: HasValues t => (BV -> BV) -> [t] -> Maybe [t] Source #

binary_bit_op :: (HasValues t1, HasValues t2) => [Char] -> (BV -> BV -> BV) -> Values t1 -> Values t2 -> Result t2 Source #

bit_nat_op :: (HasValues t1, Num b) => [Char] -> (BV -> b -> BV) -> Values t1 -> Values t2 -> Result t1 Source #

map_ :: (Ord t, HasValues t) => [OpExpr t] -> OpExpr t Source #

maps_ :: HasValues t => [OpExpr t] -> OpExpr t Source #

map_insert_ :: (HasValues t, Ord t) => [OpExpr t] -> OpExpr t Source #

map_insert :: (HasValues t, Ord t) => OpExpr t -> OpExpr t -> OpExpr t -> OpExpr t Source #

map_lookup_ :: (HasValues t, Ord t) => [OpExpr t] -> OpExpr t Source #

map_lookup :: (HasValues t, Ord t) => OpExpr t -> OpExpr t -> OpExpr t Source #

map_delete_ :: (HasValues t, Ord t) => [OpExpr t] -> OpExpr t Source #

map_delete :: (HasValues t, Ord t) => OpExpr t -> OpExpr t -> OpExpr t Source #

domain_ :: (HasValues t, Ord t) => [OpExpr t] -> OpExpr t Source #

domain :: (HasValues t, Ord t) => OpExpr t -> OpExpr t Source #

map_unite_ :: (HasValues t, Ord t) => [OpExpr t] -> OpExpr t Source #

map_unite :: (HasValues t, Ord t) => [OpExpr t] -> OpExpr t Source #

allDomainPairs :: [a] -> [(a, a)] Source #

libApp :: (HasValues t, Ord t) => OP -> [OpExpr t] -> Maybe (OpExpr t) Source #

libAppWith :: (HasValues t, Ord t) => Library t -> OP -> [OpExpr t] -> Maybe (OpExpr t) Source #

type Library t = Map OP (ValueOp t) Source #