Module

Data.Vector.Polymorphic.Class

Package
purescript-polymorphic-vectors
Repository
artemisSystem/purescript-polymorphic-vectors

#XY Source

type XY :: forall k. k -> Row k -> Row ktype XY a r = (x :: a, y :: a | r)

Shorthand describing a row containing x and y fields

#WH Source

type WH :: forall k. k -> Row k -> Row ktype WH a r = (height :: a, width :: a | r)

Shorthand describing a row containing width and height fields

#XYWH Source

type XYWH :: forall k. k -> Row k -> Row ktype XYWH a r = (XY a) + (WH a) + r

Shorthand describing a row containing x, y, width and height fields

#ToPos Source

class ToPos a pa | pa -> a where

Class describing types which represent a position on a 2D plane and can be turned into a Vector2 a.

Members

Instances

#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

#ToSize Source

class ToSize a sa | sa -> a where

Class describing types which represent a size on a 2D plane and can be turned into a Vector2 a.

Members

Instances

#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

Instances

#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

#ToRegion Source

class ToRegion a ra | ra -> a where

Class describing types which represent a rectangular region on a 2D plane and can be turned into a Rect a.

Members

Instances

  • (Semiring a) => ToRegion a (Vector2 a)
  • ToRegion a (Rect a)
  • (TypeEquals r1 (XYWH a r)) => ToRegion a (Record r1)

    With how the compiler works currently, it's not possible to have instances of ToRegion for both WH a r and XYWH a r, so you can't use a value like {width: 50, height: 50} for toRegion. If you want to use a record as a region the same way you would a Vector2, you can call toSize with it first:

    -- All these do the same thing
    outside (toSize { width: 50, height: 50 })
    outside { width: 50, height: 50, x: 0, y: 0 }
    outside (50 >< 50)
    

#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

Instances

#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

Instances

#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

Members

Instances