Module

Data.Vector.Polymorphic.Class

#XY

type XY a r = (x :: a, y :: a | r)

#WH

type WH a r = (height :: a, width :: a | r)

#XYWH

type XYWH a r = (XY a) + (WH a) + r

#ToPos

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

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

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

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

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

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

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

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

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

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

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

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

Modules