Safe Haskell | None |
---|---|
Language | Haskell2010 |
Internal AST representation.
- data GLSLType
- data ExprForm
- data Tree a = Tree {
- getElem :: a
- getChildren :: [Tree a]
- type ExprMono = Tree (ExprForm, GLSLType, String)
- data Expr ty = Expr {}
- class ToGLSLType ty where
- toGLSLType :: ty -> GLSLType
- tag :: ty
- uniform :: forall a. ToGLSLType a => String -> Expr a
- op1 :: forall a b. (ToGLSLType a, ToGLSLType b) => String -> Expr a -> Expr b
- op1'' :: forall a. ToGLSLType a => String -> Expr a -> Expr a
- op1pre :: forall a b. (ToGLSLType a, ToGLSLType b) => String -> Expr a -> Expr b
- op1pre'' :: forall a. ToGLSLType a => String -> Expr a -> Expr a
- op2 :: forall a b c. (ToGLSLType a, ToGLSLType b, ToGLSLType c) => String -> Expr a -> Expr b -> Expr c
- op2' :: forall a c. (ToGLSLType a, ToGLSLType c) => String -> Expr a -> Expr a -> Expr c
- op2'' :: forall a. ToGLSLType a => String -> Expr a -> Expr a -> Expr a
- op2pre :: forall a b c. (ToGLSLType a, ToGLSLType b, ToGLSLType c) => String -> Expr a -> Expr b -> Expr c
- op2pre' :: forall a c. (ToGLSLType a, ToGLSLType c) => String -> Expr a -> Expr a -> Expr c
- op2pre'' :: forall a. ToGLSLType a => String -> Expr a -> Expr a -> Expr a
- op3pre :: forall a b c d. (ToGLSLType a, ToGLSLType b, ToGLSLType c, ToGLSLType d) => String -> Expr a -> Expr b -> Expr c -> Expr d
- op3pre' :: forall a d. (ToGLSLType a, ToGLSLType d) => String -> Expr a -> Expr a -> Expr a -> Expr d
- op3pre'' :: forall a. ToGLSLType a => String -> Expr a -> Expr a -> Expr a -> Expr a
- op4pre :: forall a b c d e. (ToGLSLType a, ToGLSLType b, ToGLSLType c, ToGLSLType d, ToGLSLType e) => String -> Expr a -> Expr b -> Expr c -> Expr d -> Expr e
- op4pre' :: forall a e. (ToGLSLType a, ToGLSLType e) => String -> Expr a -> Expr a -> Expr a -> Expr a -> Expr e
- op4pre'' :: forall a e. (ToGLSLType a, ToGLSLType e) => String -> Expr a -> Expr a -> Expr a -> Expr a -> Expr e
- data TreeF a b = TreeF {
- getElemF :: a
- getChildrenF :: [Maybe b]
- type ExprMonoF = TreeF (ExprForm, GLSLType, String, [ExprMono])
- emfStringAt :: Show a => ExprMonoF a -> Int -> String
Documentation
Internal type tag
Internal form tag
Rose tree. Internal AST data structure
Tree | |
|
type ExprMono = Tree (ExprForm, GLSLType, String) Source
Untyped Expr representation Carries type information in type tag
Light type wrapper
Note the internal type tag is not directly dependent on the actual type!
We use the ToGLSLType typeclass to genenerate dependence from types to values
Num Booly | We use Num operators for Boolean arithmetic: |
Veccable n => Floating (Vec n) | |
Veccable n => Fractional (Vec n) | |
Veccable n => Num (Vec n) | |
ToGLSLType ty => Show (Expr ty) Source | |
Veccable n => VectorSpace (Vec n) | |
Veccable n => InnerSpace (Vec n) | |
Veccable n => AdditiveGroup (Vec n) | |
((~) * a Vec1, (~) * b Vec1) => ToVec4 (a, b, Vec2) Source | |
((~) * a Vec1, (~) * c Vec1) => ToVec4 (a, Vec2, c) Source | |
((~) * b Vec1, (~) * c Vec1) => ToVec4 (Vec2, b, c) Source | |
type Scalar (Vec n) = Vec 1 |
class ToGLSLType ty where Source
toGLSLType :: ty -> GLSLType Source
Gives us dependence from typed singleton tags to untyped tags
Singleton tag
uniform :: forall a. ToGLSLType a => String -> Expr a Source
Uniform expression.
op1 :: forall a b. (ToGLSLType a, ToGLSLType b) => String -> Expr a -> Expr b Source
Unary operator. Most generally typed.
op1'' :: forall a. ToGLSLType a => String -> Expr a -> Expr a Source
Unary operator. Input and output values have the same type.
op1pre :: forall a b. (ToGLSLType a, ToGLSLType b) => String -> Expr a -> Expr b Source
Unary operator. Prefix function call style. Most generally typed.
op1pre'' :: forall a. ToGLSLType a => String -> Expr a -> Expr a Source
Unary operator. Prefix function call style. Input and output values have the same type.
op2 :: forall a b c. (ToGLSLType a, ToGLSLType b, ToGLSLType c) => String -> Expr a -> Expr b -> Expr c Source
Binary operator. Most generally typed.
op2' :: forall a c. (ToGLSLType a, ToGLSLType c) => String -> Expr a -> Expr a -> Expr c Source
Binary operator. Arguments have the same type.
op2'' :: forall a. ToGLSLType a => String -> Expr a -> Expr a -> Expr a Source
Binary operator. Input and output values have the same type.
op2pre :: forall a b c. (ToGLSLType a, ToGLSLType b, ToGLSLType c) => String -> Expr a -> Expr b -> Expr c Source
Binary operator. Prefix function call style. Most generally typed.
op2pre' :: forall a c. (ToGLSLType a, ToGLSLType c) => String -> Expr a -> Expr a -> Expr c Source
Binary operator. Prefix function call style. Arguments have the same type.
op2pre'' :: forall a. ToGLSLType a => String -> Expr a -> Expr a -> Expr a Source
Binary operator. Prefix function call style. Input and output values have the same type.
op3pre :: forall a b c d. (ToGLSLType a, ToGLSLType b, ToGLSLType c, ToGLSLType d) => String -> Expr a -> Expr b -> Expr c -> Expr d Source
Ternary operator. Prefix function call style. Most generally typed.
op3pre' :: forall a d. (ToGLSLType a, ToGLSLType d) => String -> Expr a -> Expr a -> Expr a -> Expr d Source
Ternary operator. Prefix function call style. Arguments have the same type.
op3pre'' :: forall a. ToGLSLType a => String -> Expr a -> Expr a -> Expr a -> Expr a Source
Ternary operator. Prefix function call style. Input and output values have the same type.
op4pre :: forall a b c d e. (ToGLSLType a, ToGLSLType b, ToGLSLType c, ToGLSLType d, ToGLSLType e) => String -> Expr a -> Expr b -> Expr c -> Expr d -> Expr e Source
Quaternary operator. Prefix function call style. Most generally typed.
op4pre' :: forall a e. (ToGLSLType a, ToGLSLType e) => String -> Expr a -> Expr a -> Expr a -> Expr a -> Expr e Source
Quaternary operator. Prefix function call style. Arguments have the same type.
op4pre'' :: forall a e. (ToGLSLType a, ToGLSLType e) => String -> Expr a -> Expr a -> Expr a -> Expr a -> Expr e Source
Quaternary operator. Prefix function call style. Input and output values have the same type.
Open tree type, to be used for explicit recursion with data-reify for preserving sharing.
Note the second argument of the constructor is a list of Maybe b's. We use Maybe's to determine whether or not a child expression gets inlined.
TreeF | |
|
type ExprMonoF = TreeF (ExprForm, GLSLType, String, [ExprMono]) Source
Open untyped expression representation, to be used for explicit recursion with data-reify for preserving sharing.
Note the presence of a list of closed ExprMono's in the tuple. We use this list to recover unshared child expressions when they need to be inlined.