Data.Vector.Polymorphic.Class
- Package
- purescript-polymorphic-vectors
- Repository
- artemisSystem/purescript-polymorphic-vectors
#FromPos Source
class FromPos a pa | pa -> a where
Class describing types which represent a position on a 2D plane and can be
constructed from a Vector2 a
.
Members
Instances
#AsPosEndo Source
class AsPosEndo a pa | pa -> a where
Class describing types which represent a position on a 2D plane and can be
modified by any function of type Vector2 a → Vector2 a
.
Instances must satisfy the following law:
- Identity:
asPosEndo identity = identity
Members
Instances
#AsPos Source
class AsPos a b pa pb | pa -> a, pb -> b, pa b -> pb where
Class describing types which represent a position on a 2D plane and can be
modified by any function of type Vector2 a → Vector2 b
.
Instances must satisfy the following law:
- Identity:
asPos identity = identity
Members
Instances
AsPos a b (Vector2 a) (Vector2 b)
(TypeEquals r1 (XY a r), TypeEquals r2 (XY b r)) => AsPos a b (Record r1) (Record r2)
#FromSize Source
class FromSize a sa | sa -> a where
Class describing types which represent a size on a 2D plane and can be
constructed from a Vector2 a
.
Members
Instances
#AsSizeEndo Source
class AsSizeEndo a sa | sa -> a where
Class describing types which represent a size on a 2D plane and can be
modified by any function of type Vector2 a → Vector2 a
.
Instances must satisfy the following law:
- Identity:
asSizeEndo identity = identity
Members
asSizeEndo :: (Vector2 a -> Vector2 a) -> sa -> sa
Instances
AsSizeEndo a (Vector2 a)
AsSizeEndo a (Rect a)
(TypeEquals r1 (WH a r)) => AsSizeEndo a (Record r1)
#AsSize Source
class AsSize a b sa sb | sa -> a, sb -> b, sa b -> sb where
Class describing types which represent a size on a 2D plane and can be
modified by any function of type Vector2 a → Vector2 b
.
Instances must satisfy the following law:
- Identity:
asSize identity = identity
Members
Instances
AsSize a b (Vector2 a) (Vector2 b)
(TypeEquals r1 (WH a r), TypeEquals r2 (WH b r)) => AsSize a b (Record r1) (Record r2)
#FromRegion Source
class FromRegion a ra | ra -> a where
Class describing types which represent a rectangular region on a 2D plane
and can be constructed from a Rect a
.
Members
fromRegion :: Rect a -> ra
Instances
FromRegion a (Vector2 a)
FromRegion a (Rect a)
(TypeEquals r1 (XYWH a r), Semiring (Record r), Nub (XYWH a r) (XYWH a r)) => FromRegion a (Record r1)
#AsRegionEndo Source
class AsRegionEndo a ra | ra -> a where
Class describing types which represent a rectangular region on a 2D plane
and can be modified by any function of type Rect a → Rect a
.
Instances must satisfy the following law:
- Identity:
asRegionEndo identity = identity
Members
asRegionEndo :: (Rect a -> Rect a) -> ra -> ra
Instances
(Semiring a) => AsRegionEndo a (Vector2 a)
AsRegionEndo a (Rect a)
(TypeEquals r1 (XYWH a r)) => AsRegionEndo a (Record r1)
#AsRegion Source
class AsRegion a b ra rb | ra -> a, rb -> b, ra b -> rb where
Class describing types which represent a rectangular region on a 2D plane
and can be modified by any function of type Rect a → Rect b
.
Instances must satisfy the following law:
- Identity:
asRegion identity = identity
With how the compiler works currently, it's not possible to have instances of
ToRegion
for bothWH a r
andXYWH a r
, so you can't use a value like{width: 50, height: 50}
fortoRegion
. If you want to use a record as a region the same way you would aVector2
, you can calltoSize
with it first: