| Safe Haskell | None | 
|---|---|
| Language | Haskell2010 | 
Feldspar.Primitive.Representation
Contents
Description
Primitive Feldspar expressions
Synopsis
- type Length = Word32
 - type Index = Word32
 - data PrimTypeRep a where
- BoolT :: PrimTypeRep Bool
 - Int8T :: PrimTypeRep Int8
 - Int16T :: PrimTypeRep Int16
 - Int32T :: PrimTypeRep Int32
 - Int64T :: PrimTypeRep Int64
 - Word8T :: PrimTypeRep Word8
 - Word16T :: PrimTypeRep Word16
 - Word32T :: PrimTypeRep Word32
 - Word64T :: PrimTypeRep Word64
 - FloatT :: PrimTypeRep Float
 - DoubleT :: PrimTypeRep Double
 - ComplexFloatT :: PrimTypeRep (Complex Float)
 - ComplexDoubleT :: PrimTypeRep (Complex Double)
 
 - data IntTypeRep a where
 - data WordTypeRep a where
 - data IntWordTypeRep a where
- IntType :: IntTypeRep a -> IntWordTypeRep a
 - WordType :: WordTypeRep a -> IntWordTypeRep a
 
 - data FloatingTypeRep a where
 - data ComplexTypeRep a where
 - data PrimTypeView a where
- PrimTypeBool :: PrimTypeView Bool
 - PrimTypeIntWord :: IntWordTypeRep a -> PrimTypeView a
 - PrimTypeFloating :: FloatingTypeRep a -> PrimTypeView a
 - PrimTypeComplex :: ComplexTypeRep a -> PrimTypeView a
 
 - viewPrimTypeRep :: PrimTypeRep a -> PrimTypeView a
 - unviewPrimTypeRep :: PrimTypeView a -> PrimTypeRep a
 - primTypeIntWidth :: PrimTypeRep a -> Maybe Int
 - class (Eq a, Show a, Typeable a) => PrimType' a where
- primTypeRep :: PrimTypeRep a
 
 - primTypeOf :: PrimType' a => a -> PrimTypeRep a
 - primTypeEq :: PrimTypeRep a -> PrimTypeRep b -> Maybe (Dict (a ~ b))
 - witPrimType :: PrimTypeRep a -> Dict (PrimType' a)
 - data Primitive sig where
- FreeVar :: PrimType' a => String -> Primitive (Full a)
 - Lit :: (Eq a, Show a) => a -> Primitive (Full a)
 - Add :: (Num a, PrimType' a) => Primitive (a :-> (a :-> Full a))
 - Sub :: (Num a, PrimType' a) => Primitive (a :-> (a :-> Full a))
 - Mul :: (Num a, PrimType' a) => Primitive (a :-> (a :-> Full a))
 - Neg :: (Num a, PrimType' a) => Primitive (a :-> Full a)
 - Abs :: (Num a, PrimType' a) => Primitive (a :-> Full a)
 - Sign :: (Num a, PrimType' a) => Primitive (a :-> Full a)
 - Quot :: (Integral a, PrimType' a) => Primitive (a :-> (a :-> Full a))
 - Rem :: (Integral a, PrimType' a) => Primitive (a :-> (a :-> Full a))
 - Div :: (Integral a, PrimType' a) => Primitive (a :-> (a :-> Full a))
 - Mod :: (Integral a, PrimType' a) => Primitive (a :-> (a :-> Full a))
 - FDiv :: (Fractional a, PrimType' a) => Primitive (a :-> (a :-> Full a))
 - Pi :: (Floating a, PrimType' a) => Primitive (Full a)
 - Exp :: (Floating a, PrimType' a) => Primitive (a :-> Full a)
 - Log :: (Floating a, PrimType' a) => Primitive (a :-> Full a)
 - Sqrt :: (Floating a, PrimType' a) => Primitive (a :-> Full a)
 - Pow :: (Floating a, PrimType' a) => Primitive (a :-> (a :-> Full a))
 - Sin :: (Floating a, PrimType' a) => Primitive (a :-> Full a)
 - Cos :: (Floating a, PrimType' a) => Primitive (a :-> Full a)
 - Tan :: (Floating a, PrimType' a) => Primitive (a :-> Full a)
 - Asin :: (Floating a, PrimType' a) => Primitive (a :-> Full a)
 - Acos :: (Floating a, PrimType' a) => Primitive (a :-> Full a)
 - Atan :: (Floating a, PrimType' a) => Primitive (a :-> Full a)
 - Sinh :: (Floating a, PrimType' a) => Primitive (a :-> Full a)
 - Cosh :: (Floating a, PrimType' a) => Primitive (a :-> Full a)
 - Tanh :: (Floating a, PrimType' a) => Primitive (a :-> Full a)
 - Asinh :: (Floating a, PrimType' a) => Primitive (a :-> Full a)
 - Acosh :: (Floating a, PrimType' a) => Primitive (a :-> Full a)
 - Atanh :: (Floating a, PrimType' a) => Primitive (a :-> Full a)
 - Complex :: (Num a, PrimType' a, PrimType' (Complex a)) => Primitive (a :-> (a :-> Full (Complex a)))
 - Polar :: (Floating a, PrimType' a, PrimType' (Complex a)) => Primitive (a :-> (a :-> Full (Complex a)))
 - Real :: (PrimType' a, PrimType' (Complex a)) => Primitive (Complex a :-> Full a)
 - Imag :: (PrimType' a, PrimType' (Complex a)) => Primitive (Complex a :-> Full a)
 - Magnitude :: (RealFloat a, PrimType' a, PrimType' (Complex a)) => Primitive (Complex a :-> Full a)
 - Phase :: (RealFloat a, PrimType' a, PrimType' (Complex a)) => Primitive (Complex a :-> Full a)
 - Conjugate :: (Num a, PrimType' (Complex a)) => Primitive (Complex a :-> Full (Complex a))
 - I2N :: (Integral a, Num b, PrimType' a, PrimType' b) => Primitive (a :-> Full b)
 - I2B :: (Integral a, PrimType' a) => Primitive (a :-> Full Bool)
 - B2I :: (Integral a, PrimType' a) => Primitive (Bool :-> Full a)
 - Round :: (RealFrac a, Num b, PrimType' a, PrimType' b) => Primitive (a :-> Full b)
 - Not :: Primitive (Bool :-> Full Bool)
 - And :: Primitive (Bool :-> (Bool :-> Full Bool))
 - Or :: Primitive (Bool :-> (Bool :-> Full Bool))
 - Eq :: (Eq a, PrimType' a) => Primitive (a :-> (a :-> Full Bool))
 - NEq :: (Eq a, PrimType' a) => Primitive (a :-> (a :-> Full Bool))
 - Lt :: (Ord a, PrimType' a) => Primitive (a :-> (a :-> Full Bool))
 - Gt :: (Ord a, PrimType' a) => Primitive (a :-> (a :-> Full Bool))
 - Le :: (Ord a, PrimType' a) => Primitive (a :-> (a :-> Full Bool))
 - Ge :: (Ord a, PrimType' a) => Primitive (a :-> (a :-> Full Bool))
 - BitAnd :: (Bits a, PrimType' a) => Primitive (a :-> (a :-> Full a))
 - BitOr :: (Bits a, PrimType' a) => Primitive (a :-> (a :-> Full a))
 - BitXor :: (Bits a, PrimType' a) => Primitive (a :-> (a :-> Full a))
 - BitCompl :: (Bits a, PrimType' a) => Primitive (a :-> Full a)
 - ShiftL :: (Bits a, PrimType' a, Integral b, PrimType' b) => Primitive (a :-> (b :-> Full a))
 - ShiftR :: (Bits a, PrimType' a, Integral b, PrimType' b) => Primitive (a :-> (b :-> Full a))
 - ArrIx :: PrimType' a => IArr Index a -> Primitive (Index :-> Full a)
 - Cond :: Primitive (Bool :-> (a :-> (a :-> Full a)))
 
 - type PrimDomain = Primitive :&: PrimTypeRep
 - newtype Prim a = Prim {
- unPrim :: ASTF PrimDomain a
 
 - evalPrim :: Prim a -> a
 - sugarSymPrim :: (Signature sig, fi ~ SmartFun dom sig, sig ~ SmartSig fi, dom ~ SmartSym fi, dom ~ PrimDomain, SyntacticN f fi, sub :<: Primitive, PrimType' (DenResult sig)) => sub sig -> f
 
Types
data PrimTypeRep a where Source #
Representation of primitive supported types
Constructors
| BoolT :: PrimTypeRep Bool | |
| Int8T :: PrimTypeRep Int8 | |
| Int16T :: PrimTypeRep Int16 | |
| Int32T :: PrimTypeRep Int32 | |
| Int64T :: PrimTypeRep Int64 | |
| Word8T :: PrimTypeRep Word8 | |
| Word16T :: PrimTypeRep Word16 | |
| Word32T :: PrimTypeRep Word32 | |
| Word64T :: PrimTypeRep Word64 | |
| FloatT :: PrimTypeRep Float | |
| DoubleT :: PrimTypeRep Double | |
| ComplexFloatT :: PrimTypeRep (Complex Float) | |
| ComplexDoubleT :: PrimTypeRep (Complex Double) | 
Instances
| Show (PrimTypeRep a) Source # | |
Defined in Feldspar.Primitive.Representation Methods showsPrec :: Int -> PrimTypeRep a -> ShowS # show :: PrimTypeRep a -> String # showList :: [PrimTypeRep a] -> ShowS #  | |
data IntTypeRep a where Source #
Constructors
| Int8Type :: IntTypeRep Int8 | |
| Int16Type :: IntTypeRep Int16 | |
| Int32Type :: IntTypeRep Int32 | |
| Int64Type :: IntTypeRep Int64 | 
Instances
| Show (IntTypeRep a) Source # | |
Defined in Feldspar.Primitive.Representation Methods showsPrec :: Int -> IntTypeRep a -> ShowS # show :: IntTypeRep a -> String # showList :: [IntTypeRep a] -> ShowS #  | |
data WordTypeRep a where Source #
Constructors
| Word8Type :: WordTypeRep Word8 | |
| Word16Type :: WordTypeRep Word16 | |
| Word32Type :: WordTypeRep Word32 | |
| Word64Type :: WordTypeRep Word64 | 
Instances
| Show (WordTypeRep a) Source # | |
Defined in Feldspar.Primitive.Representation Methods showsPrec :: Int -> WordTypeRep a -> ShowS # show :: WordTypeRep a -> String # showList :: [WordTypeRep a] -> ShowS #  | |
data IntWordTypeRep a where Source #
Constructors
| IntType :: IntTypeRep a -> IntWordTypeRep a | |
| WordType :: WordTypeRep a -> IntWordTypeRep a | 
Instances
| Show (IntWordTypeRep a) Source # | |
Defined in Feldspar.Primitive.Representation Methods showsPrec :: Int -> IntWordTypeRep a -> ShowS # show :: IntWordTypeRep a -> String # showList :: [IntWordTypeRep a] -> ShowS #  | |
data FloatingTypeRep a where Source #
Constructors
| FloatType :: FloatingTypeRep Float | |
| DoubleType :: FloatingTypeRep Double | 
Instances
| Show (FloatingTypeRep a) Source # | |
Defined in Feldspar.Primitive.Representation Methods showsPrec :: Int -> FloatingTypeRep a -> ShowS # show :: FloatingTypeRep a -> String # showList :: [FloatingTypeRep a] -> ShowS #  | |
data ComplexTypeRep a where Source #
Constructors
| ComplexFloatType :: ComplexTypeRep (Complex Float) | |
| ComplexDoubleType :: ComplexTypeRep (Complex Double) | 
Instances
| Show (ComplexTypeRep a) Source # | |
Defined in Feldspar.Primitive.Representation Methods showsPrec :: Int -> ComplexTypeRep a -> ShowS # show :: ComplexTypeRep a -> String # showList :: [ComplexTypeRep a] -> ShowS #  | |
data PrimTypeView a where Source #
A different view of PrimTypeRep that allows matching on similar types
Constructors
| PrimTypeBool :: PrimTypeView Bool | |
| PrimTypeIntWord :: IntWordTypeRep a -> PrimTypeView a | |
| PrimTypeFloating :: FloatingTypeRep a -> PrimTypeView a | |
| PrimTypeComplex :: ComplexTypeRep a -> PrimTypeView a | 
Instances
| Show (PrimTypeView a) Source # | |
Defined in Feldspar.Primitive.Representation Methods showsPrec :: Int -> PrimTypeView a -> ShowS # show :: PrimTypeView a -> String # showList :: [PrimTypeView a] -> ShowS #  | |
viewPrimTypeRep :: PrimTypeRep a -> PrimTypeView a Source #
unviewPrimTypeRep :: PrimTypeView a -> PrimTypeRep a Source #
primTypeIntWidth :: PrimTypeRep a -> Maybe Int Source #
class (Eq a, Show a, Typeable a) => PrimType' a where Source #
Primitive supported types
Instances
primTypeOf :: PrimType' a => a -> PrimTypeRep a Source #
Convenience function; like primTypeRep but with an extra argument to
 constrain the type parameter. The extra argument is ignored.
primTypeEq :: PrimTypeRep a -> PrimTypeRep b -> Maybe (Dict (a ~ b)) Source #
Check whether two type representations are equal
witPrimType :: PrimTypeRep a -> Dict (PrimType' a) Source #
Reflect a PrimTypeRep to a PrimType' constraint
Expressions
data Primitive sig where Source #
Primitive operations
Constructors
Instances
| Eval Primitive Source # | |
Defined in Feldspar.Primitive.Representation Methods evalSym :: Primitive sig -> Denotation sig #  | |
| Equality Primitive Source # | |
| Render Primitive Source # | |
Defined in Feldspar.Primitive.Representation  | |
| StringTree Primitive Source # | |
Defined in Feldspar.Primitive.Representation  | |
| Symbol Primitive Source # | |
Defined in Feldspar.Primitive.Representation  | |
| EvalEnv Primitive env Source # | Assumes no occurrences of   | 
Defined in Feldspar.Primitive.Representation Methods compileSym :: proxy env -> Primitive sig -> DenotationM (Reader env) sig #  | |
| Show (Primitive a) Source # | |
type PrimDomain = Primitive :&: PrimTypeRep Source #
Primitive expressions
Constructors
| Prim | |
Fields 
  | |
Instances
| CompExp Prim Source # | |
| FreeExp Prim Source # | |
| EvalExp Prim Source # | |
Defined in Feldspar.Primitive.Representation  | |
| (Num a, PrimType' a) => Num (Prim a) Source # | |
| Syntactic (Prim a) Source # | |
| type FreePred Prim Source # | |
Defined in Feldspar.Primitive.Representation  | |
| type Internal (Prim a) Source # | |
Defined in Feldspar.Primitive.Representation  | |
| type Domain (Prim a) Source # | |
Defined in Feldspar.Primitive.Representation  | |
sugarSymPrim :: (Signature sig, fi ~ SmartFun dom sig, sig ~ SmartSig fi, dom ~ SmartSym fi, dom ~ PrimDomain, SyntacticN f fi, sub :<: Primitive, PrimType' (DenResult sig)) => sub sig -> f Source #