Module
Data.Vector2
- Package
- purescript-vectors
- Repository
- thought2/purescript-vectors
Types
Constructors
Destructors
Vector Modifiers
Componentwise Operations
Component Modifiers
Lens API
#Vec Source
data Vec a
Polymorphic 2D vector
Constructors
Vec a a
Instances
Generic (Vec a) _
(Eq a) => Eq (Vec a)
(Ord a) => Ord (Vec a)
Functor Vec
Foldable Vec
Traversable Vec
(Show a) => Show (Vec a)
(Semiring a) => Semiring (Vec a)
Componentwise
Semiring
implementation> Vec 2 3 * Vec 4 5 Vec 8 15
(Ring a) => Ring (Vec a)
Applicative Vec
Apply Vec
Zippy
Apply
implementation> (<>) <$> Vec "A" "B" <*> Vec "1" "2" Vec "A1" "B2"
#vdiv Source
vdiv :: forall a. EuclideanRing a => Vec a -> Vec a -> Vec a
Divides two vectors componentwise.
This exists because there cannot be an EuclideanRing
instance for Vec
> vdiv (Vec 9 6) (Vec 3 2)
Vec 3 3
#vmod Source
vmod :: forall a. EuclideanRing a => Vec a -> Vec a -> Vec a
Componentwise Modulo operation
This exists because there cannot be an EuclideanRing
instance for Vec
> mod (Vec 12 120) (Vec 120 100)
Vec 2 20
#half Source
half :: forall a. EuclideanRing a => Vec a -> Vec a
Halves the amount of each component
> half (Vec 10 100)
Vec 5 50
#twice Source
twice :: forall a. EuclideanRing a => Vec a -> Vec a
Duplicates the amount of each component
> twice (Vec 10 100)
Vec 20 200
- Modules
- Data.
Vector2 - Data.
Vector3
Creates a vector from two components