Safe Haskell | None |
---|---|
Language | Haskell2010 |
Internal representation of Feldspar programs
- type TypeRep = Struct PrimType' PrimTypeRep
- class (Eq a, Show a, Typeable a, Inhabited a) => Type a where
- class (PrimType' a, Type a) => PrimType a
- toTypeRep :: Struct PrimType' c a -> TypeRep a
- typeEq :: TypeRep a -> TypeRep b -> Maybe (Dict (a ~ b))
- witTypeable :: TypeRep a -> Dict (Typeable a)
- data TypeRepFun a where
- ValT :: TypeRep a -> TypeRepFun a
- FunT :: TypeRep a -> TypeRepFun b -> TypeRepFun (a -> b)
- typeEqFun :: TypeRepFun a -> TypeRepFun b -> Maybe (Dict (a ~ b))
- newtype Ref a = Ref {}
- type DRef a = Ref (Data a)
- data Arr a = Arr {}
- type DArr a = Arr (Data a)
- data IArr a = IArr {}
- type DIArr a = IArr (Data a)
- unsafeEqArrIArr :: Arr a -> IArr a -> Bool
- data AssertionLabel
- onlyUserAssertions :: Selection AssertionLabel
- data ExtraPrimitive sig where
- DivBalanced :: (Integral a, PrimType' a) => ExtraPrimitive (a :-> (a :-> Full a))
- GuardVal :: AssertionLabel -> String -> ExtraPrimitive (Bool :-> (a :-> Full a))
- data ForLoop sig where
- data Unsafe sig where
- UnsafePerform :: Comp (Data a) -> Unsafe (Full a)
- type FeldConstructs = BindingT :+: (Let :+: (Tuple :+: (Primitive :+: (ExtraPrimitive :+: (ForLoop :+: Unsafe)))))
- type FeldDomain = FeldConstructs :&: TypeRepFun
- newtype Data a = Data {
- unData :: ASTF FeldDomain a
- class (Syntactic a, Domain a ~ FeldDomain, Type (Internal a)) => Syntax a
- sugarSymFeld :: (Signature sig, fi ~ SmartFun FeldDomain sig, sig ~ SmartSig fi, FeldDomain ~ SmartSym fi, SyntacticN f fi, sub :<: FeldConstructs, Type (DenResult sig)) => sub sig -> f
- sugarSymFeldPrim :: (Signature sig, fi ~ SmartFun FeldDomain sig, sig ~ SmartSig fi, FeldDomain ~ SmartSym fi, SyntacticN f fi, sub :<: FeldConstructs, PrimType' (DenResult sig)) => sub sig -> f
- eval :: (Syntactic a, Domain a ~ FeldDomain) => a -> Internal a
- data AssertCMD fs a where
- type CompCMD = RefCMD :+: (ArrCMD :+: (ControlCMD :+: AssertCMD))
- newtype Comp a = Comp {}
Object-language types
class (Eq a, Show a, Typeable a, Inhabited a) => Type a where Source #
Supported types
Type Bool Source # | |
Type Double Source # | |
Type Float Source # | |
Type Int8 Source # | |
Type Int16 Source # | |
Type Int32 Source # | |
Type Int64 Source # | |
Type Word8 Source # | |
Type Word16 Source # | |
Type Word32 Source # | |
Type Word64 Source # | |
Type (Complex Double) Source # | |
Type (Complex Float) Source # | |
(Type a, Type b) => Type (a, b) Source # | |
typeEq :: TypeRep a -> TypeRep b -> Maybe (Dict (a ~ b)) Source #
Check whether two type representations are equal
data TypeRepFun a where Source #
Representation of supported value types + N-ary functions over such types
ValT :: TypeRep a -> TypeRepFun a | |
FunT :: TypeRep a -> TypeRepFun b -> TypeRepFun (a -> b) |
typeEqFun :: TypeRepFun a -> TypeRepFun b -> Maybe (Dict (a ~ b)) Source #
Check whether two type representations are equal
Mutable variable
Mutable array
Immutable array
unsafeEqArrIArr :: Arr a -> IArr a -> Bool Source #
Check if an Arr
and and IArr
use the same physical array. The length
and offset are ignored. This operation may give false negatives, but never
false positives. Whether or not false negatives occur may also depend on the
interpretation of the program.
Due to this unreliability, the function should only be used to affect the non-functional properties of a program (e.g. to avoid unnecessary array copying).
Pure expressions
data AssertionLabel Source #
Assertion labels
InternalAssertion | Internal assertion to guarantee meaningful results |
LibraryAssertion String | Assertion related to a specific library |
UserAssertion String | Assertion in user code. The default label for user assertions is
|
onlyUserAssertions :: Selection AssertionLabel Source #
A selection that includes all labels defined as UserAssertion
data ExtraPrimitive sig where Source #
DivBalanced :: (Integral a, PrimType' a) => ExtraPrimitive (a :-> (a :-> Full a)) | |
GuardVal :: AssertionLabel -> String -> ExtraPrimitive (Bool :-> (a :-> Full a)) |
data Unsafe sig where Source #
Interaction with the IO layer
UnsafePerform :: Comp (Data a) -> Unsafe (Full a) |
type FeldConstructs = BindingT :+: (Let :+: (Tuple :+: (Primitive :+: (ExtraPrimitive :+: (ForLoop :+: Unsafe))))) Source #
type FeldDomain = FeldConstructs :&: TypeRepFun Source #
Data | |
|
class (Syntactic a, Domain a ~ FeldDomain, Type (Internal a)) => Syntax a Source #
Specialization of the Syntactic
class for the Feldspar domain
sugarSymFeld :: (Signature sig, fi ~ SmartFun FeldDomain sig, sig ~ SmartSig fi, FeldDomain ~ SmartSym fi, SyntacticN f fi, sub :<: FeldConstructs, Type (DenResult sig)) => sub sig -> f Source #
Make a smart constructor for a symbol
sugarSymFeldPrim :: (Signature sig, fi ~ SmartFun FeldDomain sig, sig ~ SmartSig fi, FeldDomain ~ SmartSym fi, SyntacticN f fi, sub :<: FeldConstructs, PrimType' (DenResult sig)) => sub sig -> f Source #
Make a smart constructor for a symbol
eval :: (Syntactic a, Domain a ~ FeldDomain) => a -> Internal a Source #
Evaluate a closed expression
Monadic computations
data AssertCMD fs a where Source #
HFunctor k * (* -> *, (k2, *)) (AssertCMD (k -> *) k2) Source # | |
HBifunctor * * (k2, *) (AssertCMD (* -> *) k2) Source # | |
(:<:) (* -> *, (* -> *, (* -> Constraint, *))) * ControlCMD instr => Reexpressible * (* -> Constraint, *) (AssertCMD (* -> *) (* -> Constraint)) instr Env # | |
InterpBi (* -> Constraint, *) * (AssertCMD (* -> *) (* -> Constraint)) IO (Param1 (* -> Constraint) PrimType') Source # | |
Monad for computational effects: mutable data structures and control flow