Copyright | (c) David A Roberts 2015-2021 |
---|---|
License | GPL-3 |
Maintainer | d@vidr.cc |
Stability | experimental |
Safe Haskell | None |
Language | Haskell2010 |
Synopsis
- class ExprType c => Constructor c where
- tags :: Tags c
- construct :: (forall t. ExprType t => a -> Expression t) -> Tag -> [a] -> c
- deconstruct :: (forall t. ExprType t => Expression t -> a) -> c -> (Tag, [a])
- toConcreteC :: ConstVal -> c
- fromConcreteC :: c -> Expression c
- data ConstVal
- data DExpr
- type Eval = Either String ConstVal
- newtype Expression t = Expression {}
- data EEnv
- type Env = Map LVal ConstVal
- type Expr t = Expression t
- class ExprType t => ExprTuple t where
- tupleSize :: TupleSize t
- fromExprTuple :: t -> [DExpr]
- toExprTuple :: [DExpr] -> t
- fromConstVals :: [ConstVal] -> t
- typesOf :: TypesOf t
- class ExprType t where
- typeOf :: TypeOf t
- toConcrete :: ConstVal -> t
- fromConcrete :: t -> Expression t
- constVal :: t -> ConstVal
- constExpr :: ConstVal -> Expression t
- newtype FixE f = FixE {}
- type FixE' f = Expression (f (FixE f))
- class GConstructor f where
- gtypeOf :: TypeOf (f p)
- gtags :: Tags (f p)
- gconstruct :: (forall t. ExprType t => a -> Expression t) -> Tag -> [a] -> f p
- gdeconstruct :: (forall t. ExprType t => Expression t -> a) -> f p -> (Tag, [a])
- data Id
- data LVal = LVar Id
- data NodeRef
- type Tag = Int
- newtype Tags t = Tags [Tag]
- newtype TupleSize t = TupleSize Int
- data Type
- newtype TypeOf t = TypeIs Type
- newtype TypesOf t = TypesIs [Type]
- boolT :: Type
- tupleT :: [Type] -> Type
- vecT :: Type -> Type
- matT :: Type -> Type
- eval_ :: Expression t -> Eval
- eval' :: ExprType t => Expression t -> Either String t
- class Show1 (f :: Type -> Type)
- newtype Generically1 (f :: Type -> Type) a = Generically1 {
- unGenerically1 :: f a
- class Generic a
- class Generic1 (f :: k -> Type)
Documentation
class ExprType c => Constructor c where #
Stochaskell interface for algebraic data types
Nothing
list of possible tags in tagged union
tags :: (Generic c, GConstructor (Rep c)) => Tags c #
list of possible tags in tagged union
construct :: (forall t. ExprType t => a -> Expression t) -> Tag -> [a] -> c #
construct ADT from tag and arguments
construct :: (Generic c, GConstructor (Rep c)) => (forall t. ExprType t => a -> Expression t) -> Tag -> [a] -> c #
construct ADT from tag and arguments
deconstruct :: (forall t. ExprType t => Expression t -> a) -> c -> (Tag, [a]) #
deconstruct ADT to tag and arguments
deconstruct :: (Generic c, GConstructor (Rep c)) => (forall t. ExprType t => Expression t -> a) -> c -> (Tag, [a]) #
deconstruct ADT to tag and arguments
toConcreteC :: ConstVal -> c #
convert constant to ADT value
fromConcreteC :: c -> Expression c #
convert ADT value to Stochaskell expression
constant numeric array (of arbitrary dimension) or tagged union value
Instances
dynamically typed Stochaskell expression
Instances
Eq DExpr # | |
Floating DExpr # | |
Fractional DExpr # | |
Num DExpr # | |
Ord DExpr # | |
Show DExpr # | |
Semigroup DExpr # | |
Boolean DExpr # | |
IfB DExpr # | |
EqB DExpr # | |
Transposable DExpr DExpr # | |
SquareMatrix DExpr DExpr # | |
LinearOperator DExpr DExpr # | |
Matrix DExpr DExpr DExpr # | |
Defined in Data.Expression | |
Vector DExpr DExpr DExpr # | |
Defined in Data.Expression vector :: AbstractArray DExpr DExpr -> DExpr # blockVector :: [DExpr] -> DExpr # vectorSize :: DExpr -> DExpr # | |
Indexable DExpr DExpr DExpr # | |
Defined in Data.Expression | |
type BooleanOf DExpr # | |
Defined in Data.Expression |
newtype Expression t #
Stochaskell expression representation (statically typed)
Instances
type Expr t = Expression t #
class ExprType t => ExprTuple t where #
Stochaskell interface for tuples of expressions
numer of tuple elements
fromExprTuple :: t -> [DExpr] #
convert to list of expressions
toExprTuple :: [DExpr] -> t #
convert from list of expressions
fromConstVals :: [ConstVal] -> t #
convert from list of constants
list of types of elements
Instances
Stochaskell interface for native Haskell types
Nothing
corresponding Stochaskell type
typeOf :: (Generic t, GConstructor (Rep t)) => TypeOf t #
corresponding Stochaskell type
toConcrete :: ConstVal -> t #
convert constant to native value
toConcrete :: Constructor t => ConstVal -> t #
convert constant to native value
fromConcrete :: t -> Expression t #
convert native value to Stochaskell expression
fromConcrete :: Constructor t => t -> Expression t #
convert native value to Stochaskell expression
convert native value to constant
constVal :: ToConstVal t => t -> ConstVal #
convert native value to constant
constExpr :: ConstVal -> Expression t #
convert constant to Stochaskell expression
Instances
type FixE' f = Expression (f (FixE f)) #
class GConstructor f where #
gconstruct :: (forall t. ExprType t => a -> Expression t) -> Tag -> [a] -> f p #
gdeconstruct :: (forall t. ExprType t => Expression t -> a) -> f p -> (Tag, [a]) #
Instances
GConstructor (U1 :: Type -> Type) # | |
Defined in Data.Expression gconstruct :: (forall t. ExprType t => a -> Expression t) -> Tag -> [a] -> U1 p # gdeconstruct :: (forall t. ExprType t => Expression t -> a) -> U1 p -> (Tag, [a]) # | |
ExprType (f (FixE f)) => GConstructor (K1 i (FixE f) :: Type -> Type) # | |
Defined in Data.Expression | |
ExprType t => GConstructor (K1 i (Expression t) :: Type -> Type) # | |
Defined in Data.Expression gtypeOf :: TypeOf (K1 i (Expression t) p) # gtags :: Tags (K1 i (Expression t) p) # gconstruct :: (forall t0. ExprType t0 => a -> Expression t0) -> Tag -> [a] -> K1 i (Expression t) p # gdeconstruct :: (forall t0. ExprType t0 => Expression t0 -> a) -> K1 i (Expression t) p -> (Tag, [a]) # | |
(GConstructor a, GConstructor b) => GConstructor (a :+: b) # | |
Defined in Data.Expression gtypeOf :: TypeOf ((a :+: b) p) # gconstruct :: (forall t. ExprType t => a0 -> Expression t) -> Tag -> [a0] -> (a :+: b) p # gdeconstruct :: (forall t. ExprType t => Expression t -> a0) -> (a :+: b) p -> (Tag, [a0]) # | |
(GConstructor a, GConstructor b) => GConstructor (a :*: b) # | |
Defined in Data.Expression gtypeOf :: TypeOf ((a :*: b) p) # gconstruct :: (forall t. ExprType t => a0 -> Expression t) -> Tag -> [a0] -> (a :*: b) p # gdeconstruct :: (forall t. ExprType t => Expression t -> a0) -> (a :*: b) p -> (Tag, [a0]) # | |
GConstructor a => GConstructor (M1 i c a) # | |
Defined in Data.Expression gtypeOf :: TypeOf (M1 i c a p) # gconstruct :: (forall t. ExprType t => a0 -> Expression t) -> Tag -> [a0] -> M1 i c a p # gdeconstruct :: (forall t. ExprType t => Expression t -> a0) -> M1 i c a p -> (Tag, [a0]) # |
Stochaskell types
IntT | |
RealT | |
SubrangeT Type (Maybe NodeRef) (Maybe NodeRef) | |
ArrayT (Maybe String) [Interval NodeRef] Type | |
TupleT [Type] | |
UnionT [[Type]] | |
RecursiveT | |
UnknownType |
eval_ :: Expression t -> Eval #
evaluate Stochaskell expression to constant value
eval' :: ExprType t => Expression t -> Either String t #
evaluate Stochaskell expression to native value
class Show1 (f :: Type -> Type) #
Lifting of the Show
class to unary type constructors.
Since: base-4.9.0.0
Instances
Show1 [] | Since: base-4.9.0.0 |
Defined in Data.Functor.Classes | |
Show1 Maybe | Since: base-4.9.0.0 |
Show1 Identity | Since: base-4.9.0.0 |
Show1 Down | Since: base-4.12.0.0 |
Show1 NonEmpty | Since: base-4.10.0.0 |
Show1 IntMap | Since: containers-0.5.9 |
Show1 Tree | Since: containers-0.5.9 |
Show1 Seq | Since: containers-0.5.9 |
Show1 Set | Since: containers-0.5.9 |
Show1 Hashed | |
Show1 SmallArray | Since: primitive-0.6.4.0 |
Defined in Data.Primitive.SmallArray liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> SmallArray a -> ShowS # liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [SmallArray a] -> ShowS # | |
Show1 Array | Since: primitive-0.6.4.0 |
Show1 HashSet | |
Show1 Vector | |
Show1 V2 | |
Show1 V3 | |
Show1 V1 | |
Show1 Plucker | |
Defined in Linear.Plucker | |
Show1 Quaternion | |
Defined in Linear.Quaternion | |
Show1 V0 | |
Show1 V4 | |
Show a => Show1 (Either a) | Since: base-4.9.0.0 |
Show a => Show1 ((,) a) | Since: base-4.9.0.0 |
Defined in Data.Functor.Classes | |
Show k => Show1 (HashMap k) | |
Show k => Show1 (Map k) | Since: containers-0.5.9 |
Show1 (Proxy :: Type -> Type) | Since: base-4.9.0.0 |
Show1 m => Show1 (MaybeT m) | |
(Generic1 f, GShow1 (Rep1 f)) => Show1 (Generically1 f) | |
Defined in Generic.Data.Internal.Generically liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> Generically1 f a -> ShowS # liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [Generically1 f a] -> ShowS # | |
Show1 m => Show1 (ListT m) | |
Show a => Show1 (ListF a) | |
Defined in Data.Functor.Foldable | |
Show1 f => Show1 (Cofree f) | |
Defined in Control.Comonad.Cofree | |
Show1 f => Show1 (Free f) | |
Defined in Control.Monad.Free | |
Show a => Show1 (NonEmptyF a) | |
Defined in Data.Functor.Base | |
Show1 f => Show1 (Point f) | |
Defined in Linear.Affine | |
Show1 f => Show1 (Yoneda f) | |
Defined in Data.Functor.Yoneda | |
Show a => Show1 (Const a :: Type -> Type) | Since: base-4.9.0.0 |
Show1 f => Show1 (IdentityT f) | |
(Show e, Show1 m) => Show1 (ExceptT e m) | |
(Show w, Show1 m) => Show1 (WriterT w m) | |
(Show e, Show1 m) => Show1 (ErrorT e m) | |
(Show w, Show1 m) => Show1 (WriterT w m) | |
Show1 (Tagged s) | |
Show1 f => Show1 (Backwards f) | |
(Show1 f, Show1 m) => Show1 (FreeT f m) | |
Defined in Control.Monad.Trans.Free | |
(Show1 f, Show a) => Show1 (FreeF f a) | |
Defined in Control.Monad.Trans.Free | |
Show1 (V n) | |
(Show1 f, Show1 g) => Show1 (Product f g) | Since: base-4.9.0.0 |
(Show1 f, Show1 g) => Show1 (Sum f g) | Since: base-4.9.0.0 |
(Show1 f, Show1 g) => Show1 (Compose f g) | Since: base-4.9.0.0 |
newtype Generically1 (f :: Type -> Type) a #
Type with instances derived via Generic1
.
Generically1 | |
|
Instances
Representable types of kind *
.
This class is derivable in GHC with the DeriveGeneric
flag on.
A Generic
instance must satisfy the following laws:
from
.to
≡id
to
.from
≡id
Instances
class Generic1 (f :: k -> Type) #
Representable types of kind * -> *
(or kind k -> *
, when PolyKinds
is enabled).
This class is derivable in GHC with the DeriveGeneric
flag on.
A Generic1
instance must satisfy the following laws:
from1
.to1
≡id
to1
.from1
≡id