Stability | experimental |
---|---|
Maintainer | conal@conal.net |
Expressions.
- type Id = String
- data V a = V {}
- var :: HasType a => Id -> V a
- genVar :: HasType a => NameM (V a)
- type Pat = Glom V
- patT :: Pat a -> Type a
- pat :: HasType a => String -> Pat a
- data TPath
- emptyP :: TPath
- fstP :: TPath -> TPath
- sndP :: TPath -> TPath
- namePath :: String -> TPath -> String
- data E where
- type :=> a b = E a -> b
- type :=>* a b = a :=> E b
- op1 :: (HasType a, HasType b) => Op (a -> b) -> a :=>* b
- op2 :: (HasType a, HasType b, HasType c) => Op (a -> b -> c) -> a :=> (b :=>* c)
- op3 :: (HasType a, HasType b, HasType c, HasType d) => Op (a -> b -> c -> d) -> a :=> (b :=> (c :=>* d))
- op4 :: (HasType a, HasType b, HasType c, HasType d, HasType e) => Op (a -> b -> c -> d -> e) -> a :=> (b :=> (c :=> (d :=>* e)))
- pureE :: Show a => a -> E a
- fmapE :: (HasType a, HasType b) => Op (a -> b) -> a :=>* b
- liftE2 :: (HasType a, HasType b, HasType c) => Op (a -> b -> c) -> a :=> (b :=>* c)
- liftE3 :: (HasType a, HasType b, HasType c, HasType d) => Op (a -> b -> c -> d) -> a :=> (b :=> (c :=>* d))
- liftE4 :: (HasType a, HasType b, HasType c, HasType d, HasType e) => Op (a -> b -> c -> d -> e) -> a :=> (b :=> (c :=> (d :=>* e)))
- notE :: IsNat n => Vec n Bool :=>* Vec n Bool
- (==^) :: (IsNat n, IsScalar a, Eq a, Show a) => Vec n a :=> (Vec n a :=>* B1)
- (/=^) :: (IsNat n, IsScalar a, Eq a, Show a) => Vec n a :=> (Vec n a :=>* B1)
- truncateE :: IsNat n => Vec n R :=>* Vec n R
- roundE :: IsNat n => Vec n R :=>* Vec n R
- ceilingE :: IsNat n => Vec n R :=>* Vec n R
- floorE :: IsNat n => Vec n R :=>* Vec n R
- allV :: IsNat n => Vec n Bool :=>* B1
- anyV :: IsNat n => Vec n Bool :=>* B1
- type SamplerE n = E (Sampler n)
- texture :: IsNat n => Sampler n :=> (Vec n R :=>* R4)
- lit :: Show a => a -> E a
- type BoolE = E B1
- type FloatE = E R1
- type R1E = E R1
- type R2E = E R2
- type R3E = E R3
- type R4E = E R4
- type VecE n a = E (Vec n a)
- vec2 :: (IsScalar a, Show a) => One a :=> (One a :=>* Two a)
- vec3 :: (IsScalar a, Show a) => One a :=> (One a :=> (One a :=>* Three a))
- vec4 :: (IsScalar a, Show a) => One a :=> (One a :=> (One a :=> (One a :=>* Four a)))
- un2 :: IsScalar a => Two a :=> (E (One a), E (One a))
- un3 :: IsScalar a => Three a :=> (E (One a), E (One a), E (One a))
- un4 :: IsScalar a => Four a :=> (E (One a), E (One a), E (One a), E (One a))
- getX :: (IsNat n, IsScalar a, Show a) => Vec (S n) a :=>* One a
- getY :: (IsNat n, IsScalar a, Show a) => Vec (S (S n)) a :=>* One a
- getZ :: (IsNat n, IsScalar a, Show a) => Vec (S (S (S n))) a :=>* One a
- getW :: (IsNat n, IsScalar a, Show a) => Vec (S (S (S (S n)))) a :=>* One a
- get :: (IsNat n, IsScalar a, Show a) => Index n -> Vec n a :=>* One a
- (<+>) :: (IsNat m, IsNat n, IsNat (m :+: n), IsScalar a, Show a) => Vec m a :=> (Vec n a :=>* Vec (m :+: n) a)
- unitE :: E ()
- pairE :: (HasType a, HasType b) => E a -> E b -> E (a, b)
- fstE :: (HasType a, HasType b) => Show a => E (a, b) -> E a
- sndE :: (HasType a, HasType b) => Show b => E (a, b) -> E b
- unPairE :: (HasType a, HasType b) => E (a, b) -> (E a, E b)
- uniform :: (IsNat n, IsScalar a, Show a) => (E (Vec n a) -> b) -> E (One a) -> b
- uniformV :: (IsNat n, IsScalar a, Show a) => One a :=>* Vec n a
- type ComplexE a = Complex (E (One a))
- class ToE w where
- toE :: ToE w => w -> E (ExpT w)
- class ToE w => FromE w where
- toFromE :: (FromE v, FromE w) => (v -> w) -> E (ExpT v) -> E (ExpT w)
- patE :: Pat a -> E a
- module Shady.Language.Type
- letE :: (HasType a, HasType b) => V a -> E a -> E b -> E b
Variables
Typed variables
Patterns
Type paths
Expressions
Simple expressions (no Let
). Statically typed.
Constructors for operator/constant (Op
), variable (Var
),
application ('(:^)'), and abstraction (Lam
).
Op :: Op a -> E a | |
Var :: V a -> E a | |
:^ :: HasType a => E (a -> b) -> E a -> E b | |
Lam :: HasType a => V a -> E b -> E (a -> b) |
n-ary operator application
op2 :: (HasType a, HasType b, HasType c) => Op (a -> b -> c) -> a :=> (b :=>* c)Source
Convenient operator application
op3 :: (HasType a, HasType b, HasType c, HasType d) => Op (a -> b -> c -> d) -> a :=> (b :=> (c :=>* d))Source
Convenient operator application
op4 :: (HasType a, HasType b, HasType c, HasType d, HasType e) => Op (a -> b -> c -> d -> e) -> a :=> (b :=> (c :=> (d :=>* e)))Source
Convenient operator application
Optimizing expression-builders
fmapE :: (HasType a, HasType b) => Op (a -> b) -> a :=>* bSource
Apply a unary operator, with constant-folding and simplifications
liftE2 :: (HasType a, HasType b, HasType c) => Op (a -> b -> c) -> a :=> (b :=>* c)Source
Apply a binary operator, with constant-folding and simplifications
liftE3 :: (HasType a, HasType b, HasType c, HasType d) => Op (a -> b -> c -> d) -> a :=> (b :=> (c :=>* d))Source
Apply a ternary operator, with constant-folding and simplifications
liftE4 :: (HasType a, HasType b, HasType c, HasType d, HasType e) => Op (a -> b -> c -> d -> e) -> a :=> (b :=> (c :=> (d :=>* e)))Source
Apply an quaternary operator, with constant-folding and simplifications
Operations
(==^) :: (IsNat n, IsScalar a, Eq a, Show a) => Vec n a :=> (Vec n a :=>* B1)Source
Vector equality, resulting in a single Bool. See also '(==*)'.
(/=^) :: (IsNat n, IsScalar a, Eq a, Show a) => Vec n a :=> (Vec n a :=>* B1)Source
Vector inequality, resulting in a single Bool. See also '(/=*)'.
getW :: (IsNat n, IsScalar a, Show a) => Vec (S (S (S (S n)))) a :=>* One aSource
Extract W component
(<+>) :: (IsNat m, IsNat n, IsNat (m :+: n), IsScalar a, Show a) => Vec m a :=> (Vec n a :=>* Vec (m :+: n) a)Source
Concatenation of vectors
uniform :: (IsNat n, IsScalar a, Show a) => (E (Vec n a) -> b) -> E (One a) -> bSource
Uniform version of a function on vectors
Conversion to expressions
Value convertible to an expression
ToE () | |
(Show a, IsScalar a) => ToE (ComplexE a) | |
ToE (E a) | |
ToE (Pat a) | |
(FromE u, ToE v, HasType (ExpT u)) => ToE (u -> v) | |
(ToE u, Show (ExpT u), HasType (ExpT u), ToE v, Show (ExpT v), HasType (ExpT v)) => ToE (u, v) | |
(ToE u, HasType (ExpT u), ToE v, HasType (ExpT v), ToE w, HasType (ExpT w)) => ToE (u, v, w) |
module Shady.Language.Type