Safe Haskell | None |
---|---|
Language | Haskell2010 |
SDL's vector representation.
By default, re-exports the Linear and Linear.Affine modules from the
linear
package. With the no-linear
Cabal flag, instead exports a
duplicate implementation of the V2
, V3
, V4
and Point
types from
SDL.Internal.Vect, which provides as many instances as possible for those
types while avoiding any additional dependencies.
Point
newtype Point (f :: * -> *) a :: (* -> *) -> * -> * #
A handy wrapper to help distinguish points from vectors at the type level
P (f a) |
Unbox (f a) => Vector Vector (Point f a) | |
basicUnsafeFreeze :: PrimMonad m => Mutable Vector (PrimState m) (Point f a) -> m (Vector (Point f a)) # basicUnsafeThaw :: PrimMonad m => Vector (Point f a) -> m (Mutable Vector (PrimState m) (Point f a)) # basicLength :: Vector (Point f a) -> Int # basicUnsafeSlice :: Int -> Int -> Vector (Point f a) -> Vector (Point f a) # basicUnsafeIndexM :: Monad m => Vector (Point f a) -> Int -> m (Point f a) # basicUnsafeCopy :: PrimMonad m => Mutable Vector (PrimState m) (Point f a) -> Vector (Point f a) -> m () # | |
Unbox (f a) => MVector MVector (Point f a) | |
basicLength :: MVector s (Point f a) -> Int # basicUnsafeSlice :: Int -> Int -> MVector s (Point f a) -> MVector s (Point f a) # basicOverlaps :: MVector s (Point f a) -> MVector s (Point f a) -> Bool # basicUnsafeNew :: PrimMonad m => Int -> m (MVector (PrimState m) (Point f a)) # basicInitialize :: PrimMonad m => MVector (PrimState m) (Point f a) -> m () # basicUnsafeReplicate :: PrimMonad m => Int -> Point f a -> m (MVector (PrimState m) (Point f a)) # basicUnsafeRead :: PrimMonad m => MVector (PrimState m) (Point f a) -> Int -> m (Point f a) # basicUnsafeWrite :: PrimMonad m => MVector (PrimState m) (Point f a) -> Int -> Point f a -> m () # basicClear :: PrimMonad m => MVector (PrimState m) (Point f a) -> m () # basicSet :: PrimMonad m => MVector (PrimState m) (Point f a) -> Point f a -> m () # basicUnsafeCopy :: PrimMonad m => MVector (PrimState m) (Point f a) -> MVector (PrimState m) (Point f a) -> m () # basicUnsafeMove :: PrimMonad m => MVector (PrimState m) (Point f a) -> MVector (PrimState m) (Point f a) -> m () # basicUnsafeGrow :: PrimMonad m => MVector (PrimState m) (Point f a) -> Int -> m (MVector (PrimState m) (Point f a)) # | |
Monad f => Monad (Point f) | |
Functor f => Functor (Point f) | |
Applicative f => Applicative (Point f) | |
Foldable f => Foldable (Point f) | |
fold :: Monoid m => Point f m -> m # foldMap :: Monoid m => (a -> m) -> Point f a -> m # foldr :: (a -> b -> b) -> b -> Point f a -> b # foldr' :: (a -> b -> b) -> b -> Point f a -> b # foldl :: (b -> a -> b) -> b -> Point f a -> b # foldl' :: (b -> a -> b) -> b -> Point f a -> b # foldr1 :: (a -> a -> a) -> Point f a -> a # foldl1 :: (a -> a -> a) -> Point f a -> a # elem :: Eq a => a -> Point f a -> Bool # maximum :: Ord a => Point f a -> a # minimum :: Ord a => Point f a -> a # | |
Traversable f => Traversable (Point f) | |
Distributive f => Distributive (Point f) | |
Representable f => Representable (Point f) | |
Eq1 f => Eq1 (Point f) | |
Ord1 f => Ord1 (Point f) | |
Read1 f => Read1 (Point f) | |
Show1 f => Show1 (Point f) | |
Serial1 f => Serial1 (Point f) | |
serializeWith :: MonadPut m => (a -> m ()) -> Point f a -> m () # deserializeWith :: MonadGet m => m a -> m (Point f a) # | |
Additive f => Affine (Point f) | |
R4 f => R4 (Point f) | |
R3 f => R3 (Point f) | |
R2 f => R2 (Point f) | |
R1 f => R1 (Point f) | |
Finite f => Finite (Point f) | |
Metric f => Metric (Point f) | |
Additive f => Additive (Point f) | |
Apply f => Apply (Point f) | |
Bind f => Bind (Point f) | |
Generic1 * (Point f) | |
Eq (f a) => Eq (Point f a) | |
Fractional (f a) => Fractional (Point f a) | |
(Data (f a), Typeable * a, Typeable (* -> *) f) => Data (Point f a) | |
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Point f a -> c (Point f a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Point f a) # toConstr :: Point f a -> Constr # dataTypeOf :: Point f a -> DataType # dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c (Point f a)) # dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Point f a)) # gmapT :: (forall b. Data b => b -> b) -> Point f a -> Point f a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Point f a -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Point f a -> r # gmapQ :: (forall d. Data d => d -> u) -> Point f a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Point f a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Point f a -> m (Point f a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Point f a -> m (Point f a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Point f a -> m (Point f a) # | |
Num (f a) => Num (Point f a) | |
Ord (f a) => Ord (Point f a) | |
Read (f a) => Read (Point f a) | |
Show (f a) => Show (Point f a) | |
Ix (f a) => Ix (Point f a) | |
range :: (Point f a, Point f a) -> [Point f a] # index :: (Point f a, Point f a) -> Point f a -> Int # unsafeIndex :: (Point f a, Point f a) -> Point f a -> Int inRange :: (Point f a, Point f a) -> Point f a -> Bool # rangeSize :: (Point f a, Point f a) -> Int # unsafeRangeSize :: (Point f a, Point f a) -> Int | |
Generic (Point f a) | |
Storable (f a) => Storable (Point f a) | |
Binary (f a) => Binary (Point f a) | |
Serial (f a) => Serial (Point f a) | |
Serialize (f a) => Serialize (Point f a) | |
NFData (f a) => NFData (Point f a) | |
Hashable (f a) => Hashable (Point f a) | |
Unbox (f a) => Unbox (Point f a) | |
Ixed (f a) => Ixed (Point f a) | |
Wrapped (Point f a) | |
Epsilon (f a) => Epsilon (Point f a) | |
(~) * t (Point g b) => Rewrapped (Point f a) t | |
Traversable f => Each (Point f a) (Point f b) a b | |
data MVector s (Point f a) | |
type Rep (Point f) | |
type Diff (Point f) | |
type Size (Point f) | |
type Rep1 * (Point f) | |
type Rep (Point f a) | |
data Vector (Point f a) | |
type Index (Point f a) | |
type IxValue (Point f a) | |
type Unwrapped (Point f a) | |
Vectors
A 2-dimensional vector
>>>
pure 1 :: V2 Int
V2 1 1
>>>
V2 1 2 + V2 3 4
V2 4 6
>>>
V2 1 2 * V2 3 4
V2 3 8
>>>
sum (V2 1 2)
3
V2 !a !a |
Monad V2 | |
Functor V2 | |
MonadFix V2 | |
Applicative V2 | |
Foldable V2 | |
fold :: Monoid m => V2 m -> m # foldMap :: Monoid m => (a -> m) -> V2 a -> m # foldr :: (a -> b -> b) -> b -> V2 a -> b # foldr' :: (a -> b -> b) -> b -> V2 a -> b # foldl :: (b -> a -> b) -> b -> V2 a -> b # foldl' :: (b -> a -> b) -> b -> V2 a -> b # foldr1 :: (a -> a -> a) -> V2 a -> a # foldl1 :: (a -> a -> a) -> V2 a -> a # elem :: Eq a => a -> V2 a -> Bool # maximum :: Ord a => V2 a -> a # | |
Traversable V2 | |
Distributive V2 | |
Representable V2 | |
Eq1 V2 | |
Ord1 V2 | |
Read1 V2 | |
Show1 V2 | |
MonadZip V2 | |
Serial1 V2 | |
serializeWith :: MonadPut m => (a -> m ()) -> V2 a -> m () # deserializeWith :: MonadGet m => m a -> m (V2 a) # | |
Traversable1 V2 | |
Affine V2 | |
R2 V2 | |
R1 V2 | |
Finite V2 | |
Metric V2 | |
Additive V2 | |
Foldable1 V2 | |
Apply V2 | |
Bind V2 | |
Unbox a => Vector Vector (V2 a) | |
basicUnsafeFreeze :: PrimMonad m => Mutable Vector (PrimState m) (V2 a) -> m (Vector (V2 a)) # basicUnsafeThaw :: PrimMonad m => Vector (V2 a) -> m (Mutable Vector (PrimState m) (V2 a)) # basicLength :: Vector (V2 a) -> Int # basicUnsafeSlice :: Int -> Int -> Vector (V2 a) -> Vector (V2 a) # basicUnsafeIndexM :: Monad m => Vector (V2 a) -> Int -> m (V2 a) # basicUnsafeCopy :: PrimMonad m => Mutable Vector (PrimState m) (V2 a) -> Vector (V2 a) -> m () # | |
Unbox a => MVector MVector (V2 a) | |
basicLength :: MVector s (V2 a) -> Int # basicUnsafeSlice :: Int -> Int -> MVector s (V2 a) -> MVector s (V2 a) # basicOverlaps :: MVector s (V2 a) -> MVector s (V2 a) -> Bool # basicUnsafeNew :: PrimMonad m => Int -> m (MVector (PrimState m) (V2 a)) # basicInitialize :: PrimMonad m => MVector (PrimState m) (V2 a) -> m () # basicUnsafeReplicate :: PrimMonad m => Int -> V2 a -> m (MVector (PrimState m) (V2 a)) # basicUnsafeRead :: PrimMonad m => MVector (PrimState m) (V2 a) -> Int -> m (V2 a) # basicUnsafeWrite :: PrimMonad m => MVector (PrimState m) (V2 a) -> Int -> V2 a -> m () # basicClear :: PrimMonad m => MVector (PrimState m) (V2 a) -> m () # basicSet :: PrimMonad m => MVector (PrimState m) (V2 a) -> V2 a -> m () # basicUnsafeCopy :: PrimMonad m => MVector (PrimState m) (V2 a) -> MVector (PrimState m) (V2 a) -> m () # basicUnsafeMove :: PrimMonad m => MVector (PrimState m) (V2 a) -> MVector (PrimState m) (V2 a) -> m () # basicUnsafeGrow :: PrimMonad m => MVector (PrimState m) (V2 a) -> Int -> m (MVector (PrimState m) (V2 a)) # | |
Bounded a => Bounded (V2 a) | |
Eq a => Eq (V2 a) | |
Floating a => Floating (V2 a) | |
Fractional a => Fractional (V2 a) | |
Data a => Data (V2 a) | |
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> V2 a -> c (V2 a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (V2 a) # dataTypeOf :: V2 a -> DataType # dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c (V2 a)) # dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (V2 a)) # gmapT :: (forall b. Data b => b -> b) -> V2 a -> V2 a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> V2 a -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> V2 a -> r # gmapQ :: (forall d. Data d => d -> u) -> V2 a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> V2 a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> V2 a -> m (V2 a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> V2 a -> m (V2 a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> V2 a -> m (V2 a) # | |
Num a => Num (V2 a) | |
Ord a => Ord (V2 a) | |
Read a => Read (V2 a) | |
Show a => Show (V2 a) | |
Ix a => Ix (V2 a) | |
Generic (V2 a) | |
Storable a => Storable (V2 a) | |
Binary a => Binary (V2 a) | |
Serial a => Serial (V2 a) | |
Serialize a => Serialize (V2 a) | |
NFData a => NFData (V2 a) | |
Hashable a => Hashable (V2 a) | |
Unbox a => Unbox (V2 a) | |
Ixed (V2 a) | |
Epsilon a => Epsilon (V2 a) | |
Generic1 * V2 | |
FunctorWithIndex (E V2) V2 | |
FoldableWithIndex (E V2) V2 | |
ifoldMap :: Monoid m => (E V2 -> a -> m) -> V2 a -> m # ifolded :: (Indexable (E V2) p, Contravariant f, Applicative f) => p a (f a) -> V2 a -> f (V2 a) # ifoldr :: (E V2 -> a -> b -> b) -> b -> V2 a -> b # ifoldl :: (E V2 -> b -> a -> b) -> b -> V2 a -> b # | |
TraversableWithIndex (E V2) V2 | |
itraverse :: Applicative f => (E V2 -> a -> f b) -> V2 a -> f (V2 b) # itraversed :: (Indexable (E V2) p, Applicative f) => p a (f b) -> V2 a -> f (V2 b) # | |
Each (V2 a) (V2 b) a b | |
type Rep V2 | |
type Diff V2 | |
type Size V2 | |
data MVector s (V2 a) | |
type Rep (V2 a) | |
type Rep (V2 a) = D1 * (MetaData "V2" "Linear.V2" "linear-1.20.7-LXCU1sgu5RWEuZCU6HpVeA" False) (C1 * (MetaCons "V2" PrefixI False) ((:*:) * (S1 * (MetaSel (Nothing Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 * a)) (S1 * (MetaSel (Nothing Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 * a)))) | |
data Vector (V2 a) | |
type Index (V2 a) | |
type IxValue (V2 a) | |
type Rep1 * V2 | |
type Rep1 * V2 = D1 * (MetaData "V2" "Linear.V2" "linear-1.20.7-LXCU1sgu5RWEuZCU6HpVeA" False) (C1 * (MetaCons "V2" PrefixI False) ((:*:) * (S1 * (MetaSel (Nothing Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) Par1) (S1 * (MetaSel (Nothing Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) Par1))) |
A 3-dimensional vector
V3 !a !a !a |
A 4-dimensional vector.
V4 !a !a !a !a |