Stability | experimental |
---|---|
Maintainer | conal@conal.net |
Types
- data ScalarT where
- data VectorT n a = VectorT (Nat n) (ScalarT a)
- data Type where
- type TextureId = Int
- data Sampler n = Sampler {
- samplerDim :: Nat n
- samplerTexture :: TextureId
- sampler1 :: TextureId -> Sampler1
- sampler2 :: TextureId -> Sampler2
- sampler3 :: TextureId -> Sampler3
- type Sampler1 = Sampler OneT
- type Sampler2 = Sampler TwoT
- type Sampler3 = Sampler ThreeT
- class (Storable a, Typeable a, Show a) => IsScalar a where
- vectorT :: (IsNat n, IsScalar a) => VectorT n a
- class Show t => HasType t where
- typeOf :: HasType a => a -> Type a
- typeOf1 :: HasType a => f a -> Type a
- typeOf2 :: HasType a => g (f a) -> Type a
- compatible :: (HasType a, HasType b) => a -> b -> Maybe (a :=: b)
- compatible1 :: (HasType a, HasType b) => f a -> g b -> Maybe (a :=: b)
- data IsVec where
- checkVec :: forall t. HasType t => Maybe (IsVec t)
- checkVec' :: forall f t. HasType t => f t -> Maybe (IsVec t)
- data ($a) :=: ($b) where
- ptyEq :: ScalarT a -> ScalarT b -> Maybe (a :=: b)
- vtyEq :: VectorT m a -> VectorT n b -> Maybe (Vec m a :=: Vec n b)
- tyEq :: Type c -> Type c' -> Maybe (c :=: c')
- (=:=) :: forall f a b. (HasType a, HasType b, SynEq f) => f a -> f b -> Maybe (a :=: b)
- (===) :: forall f a b. (HasType a, HasType b, SynEq f) => f a -> f b -> Bool
- type R = Float
- type R1 = One R
- type R2 = Two R
- type R3 = Three R
- type R4 = Four R
- type B1 = One Bool
- type Pred1 a = a -> B1
- type Pred2 a = a -> Pred1 a
- class SynEq f where
- class SynEq2 f where
- class PairF f where
- type :# a b = (a, b)
- class UnitF f where
- module Shady.Vec
Type values
Extended types. Vector types, samplers, unit, pairing, and functions.
Encoding of texture ids in values. I'm using Int
instead of
GLuint
here to avoid depending on OpenGL in this module & package.
An n
-dimensional GLSL sampler.
Sampler | |
|
Generating type values
compatible :: (HasType a, HasType b) => a -> b -> Maybe (a :=: b)Source
Do two values have the same type. If so, return a proof.
compatible1 :: (HasType a, HasType b) => f a -> g b -> Maybe (a :=: b)Source
Do two values have the same argument type. If so, return a proof.
Demonstration that a type argument is a vector type.
checkVec' :: forall f t. HasType t => f t -> Maybe (IsVec t)Source
Convenient wrapper around checkVec
. Ignores argument.
Type equality
vtyEq :: VectorT m a -> VectorT n b -> Maybe (Vec m a :=: Vec n b)Source
Try to prove equality of types
(===) :: forall f a b. (HasType a, HasType b, SynEq f) => f a -> f b -> BoolSource
Same type and syntactically equal
Vector operations
Convenient type synonyms
Notions of equality
Syntactic equality. Requires same argument type.
Higher-order variant of SynEq
. Can be defined via '(=-=)', or vice versa.
Pairing and unit
Syntactic alternative for pairing. Convenient for right-associative infix use.
Re-export
module Shady.Vec