-data Vec2D a = Vec2D a a
-type instance Dim Vec2D = N2
-instance Vector Vec2D a where
- inspect (Vec2D x y) (Fun f) = f x y
- construct = Fun Vec2D
-
-data Vec3D a = Vec3D a a a
-type instance Dim Vec3D = N3
-instance Vector Vec3D a where
- inspect (Vec3D x y z) (Fun f) = f x y z
- construct = Fun Vec3D
-
-data Vec4D a = Vec4D a a a a
-type instance Dim Vec4D = N4
-instance Vector Vec4D a where
- inspect (Vec4D w x y z) (Fun f) = f w x y z
- construct = Fun Vec4D
-
-
--- | Convenience function for creating 2d vectors.
---
--- Examples:
---
--- >>> let v1 = make2d (1,2)
--- >>> v1
--- (1,2)
--- >>> let Vn (Vec2D x y) = v1
--- >>> (x,y)
--- (1,2)
---
-make2d :: forall a. (a,a) -> Vn Vec2D a
-make2d (x,y) = Vn (Vec2D x y)
-
-
--- | Convenience function for creating 3d vectors.
---
--- Examples:
---
--- >>> let v1 = make3d (1,2,3)
--- >>> v1
--- (1,2,3)
--- >>> let Vn (Vec3D x y z) = v1
--- >>> (x,y,z)
--- (1,2,3)
---
-make3d :: forall a. (a,a,a) -> Vn Vec3D a
-make3d (x,y,z) = Vn (Vec3D x y z)
-
-
--- | Convenience function for creating 4d vectors.
---
--- Examples:
---
--- >>> let v1 = make4d (1,2,3,4)
--- >>> v1
--- (1,2,3,4)
--- >>> let Vn (Vec4D w x y z) = v1
--- >>> (w,x,y,z)
--- (1,2,3,4)
---
-make4d :: forall a. (a,a,a,a) -> Vn Vec4D a
-make4d (w,x,y,z) = Vn (Vec4D w x y z)