Safe Haskell | None |
---|---|
Language | Haskell2010 |
Internal representation of Feldspar programs
Synopsis
- 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
- data AssertCMD fs a where
- type CompCMD = RefCMD :+: (ArrCMD :+: (ControlCMD :+: AssertCMD))
- newtype Comp a = Comp {}
- eval :: (Syntactic a, Domain a ~ FeldDomain) => a -> Internal a
Object-language types
class (Eq a, Show a, Typeable a, Inhabited a) => Type a where Source #
Supported types
Instances
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 # | |
Defined in Feldspar.Representation |
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
Instances
Eq (Arr a) Source # |
|
Slicable (Arr a) Source # | |
Finite (Arr a) Source # | |
(MarshalHaskell (Internal a), MarshalFeld a, Syntax a) => MarshalFeld (Arr a) Source # | |
(Syntax a, BulkTransferable a, ContainerType a ~ Arr a) => Transferable (Arr a) Source # | |
Defined in Feldspar.Data.Vector calcChanSize :: proxy (Arr a) -> SizeSpec (Arr a) -> ChanSize Data PrimType' Length Source # newChan :: SizeSpec (Arr a) -> Run (Chan Uncloseable (Arr a)) Source # newCloseableChan :: SizeSpec (Arr a) -> Run (Chan Closeable (Arr a)) Source # readChan :: Chan t (Arr a) -> Run (Arr a) Source # untypedReadChan :: Chan t c -> Run (Arr a) Source # writeChan :: Chan t (Arr a) -> Arr a -> Run (Data Bool) Source # untypedWriteChan :: Chan t c -> Arr a -> Run (Data Bool) Source # | |
type HaskellRep (Arr a) Source # | |
Defined in Feldspar.Run.Marshal | |
type SizeSpec (Arr a) Source # | |
Defined in Feldspar.Data.Vector |
Immutable array
Instances
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
|
Instances
Eq AssertionLabel Source # | |
Defined in Feldspar.Representation (==) :: AssertionLabel -> AssertionLabel -> Bool # (/=) :: AssertionLabel -> AssertionLabel -> Bool # | |
Show AssertionLabel Source # | |
Defined in Feldspar.Representation showsPrec :: Int -> AssertionLabel -> ShowS # show :: AssertionLabel -> String # showList :: [AssertionLabel] -> ShowS # |
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)) |
Instances
Eval ExtraPrimitive Source # | |
Defined in Feldspar.Representation evalSym :: ExtraPrimitive sig -> Denotation sig # | |
Equality ExtraPrimitive Source # | |
Defined in Feldspar.Representation equal :: ExtraPrimitive a -> ExtraPrimitive b -> Bool # hash :: ExtraPrimitive a -> Hash # | |
Render ExtraPrimitive Source # | |
Defined in Feldspar.Representation renderSym :: ExtraPrimitive sig -> String # renderArgs :: [String] -> ExtraPrimitive sig -> String # | |
StringTree ExtraPrimitive Source # | |
Defined in Feldspar.Representation stringTreeSym :: [Tree String] -> ExtraPrimitive a -> Tree String # | |
Symbol ExtraPrimitive Source # | |
Defined in Feldspar.Representation symSig :: ExtraPrimitive sig -> SigRep sig # | |
EvalEnv ExtraPrimitive env Source # | |
Defined in Feldspar.Representation compileSym :: proxy env -> ExtraPrimitive sig -> DenotationM (Reader env) sig # |
data ForLoop sig where Source #
For loop
Instances
Eval ForLoop Source # | |
Defined in Feldspar.Representation evalSym :: ForLoop sig -> Denotation sig # | |
Equality ForLoop Source # | |
Render ForLoop Source # | |
Defined in Feldspar.Representation | |
StringTree ForLoop Source # | |
Defined in Feldspar.Representation | |
Symbol ForLoop Source # | |
Defined in Feldspar.Representation | |
EvalEnv ForLoop env Source # | |
Defined in Feldspar.Representation compileSym :: proxy env -> ForLoop sig -> DenotationM (Reader env) sig # |
data Unsafe sig where Source #
Interaction with the IO layer
UnsafePerform :: Comp (Data a) -> Unsafe (Full a) |
Instances
Eval Unsafe Source # | |
Defined in Feldspar.Representation evalSym :: Unsafe sig -> Denotation sig # | |
Equality Unsafe Source # | |
Render Unsafe Source # | |
Defined in Feldspar.Representation | |
StringTree Unsafe Source # | |
Defined in Feldspar.Representation | |
Symbol Unsafe Source # | |
Defined in Feldspar.Representation | |
EvalEnv Unsafe env Source # | |
Defined in Feldspar.Representation compileSym :: proxy env -> Unsafe sig -> DenotationM (Reader env) sig # |
type FeldConstructs = BindingT :+: (Let :+: (Tuple :+: (Primitive :+: (ExtraPrimitive :+: (ForLoop :+: Unsafe))))) Source #
type FeldDomain = FeldConstructs :&: TypeRepFun Source #
Data | |
|
Instances
class (Syntactic a, Domain a ~ FeldDomain, Type (Internal a)) => Syntax a Source #
Specialization of the Syntactic
class for the Feldspar domain
Instances
(Syntactic a, Domain a ~ FeldDomain, Type (Internal a)) => Syntax a Source # | |
Defined in Feldspar.Representation |
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
Monadic computations
data AssertCMD fs a where Source #
Instances
HFunctor (AssertCMD :: (k -> Type, (Type -> Type, (k2, Type))) -> Type -> Type) Source # | |
Defined in Feldspar.Representation | |
HBifunctor (AssertCMD :: (Type -> Type, (Type -> Type, (k2, Type))) -> Type -> Type) Source # | |
ControlCMD :<: instr => Reexpressible (AssertCMD :: (Type -> Type, (Type -> Type, (Type -> Constraint, Type))) -> Type -> Type) (instr :: (Type -> Type, (Type -> Type, (Type -> Constraint, Type))) -> Type -> Type) Env Source # | |
Defined in Feldspar.Run.Compile | |
InterpBi (AssertCMD :: (Type -> Type, (Type -> Type, (Type -> Constraint, Type))) -> Type -> Type) IO (Param1 PrimType') Source # | |
Monad for computational effects: mutable data structures and control flow
Instances
Monad Comp Source # | |
Functor Comp Source # | |
Applicative Comp Source # | |
MonadComp Comp Source # | |
MonadRun Comp Source # | |
Syntax a => Storable (Push Comp a) Source # | |
Defined in Feldspar.Data.Storable newStoreRep :: MonadComp m => proxy (Push Comp a) -> StoreSize (Push Comp a) -> m (StoreRep (Push Comp a)) Source # initStoreRep :: MonadComp m => Push Comp a -> m (StoreRep (Push Comp a)) Source # readStoreRep :: MonadComp m => StoreRep (Push Comp a) -> m (Push Comp a) Source # unsafeFreezeStoreRep :: MonadComp m => StoreRep (Push Comp a) -> m (Push Comp a) Source # writeStoreRep :: MonadComp m => StoreRep (Push Comp a) -> Push Comp a -> m () Source # | |
type StoreRep (Push Comp a) Source # | |
type StoreSize (Push Comp a) Source # | |