HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Modulelinear-1.22Haskell2010

Linear.Affine

Operations on affine spaces.

  • 1 type
  • 1 class
  • 9 values
  • Packagelinear-1.22
  • Exports11
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceAffine.hs
classclass Additive (Diff p) => Affine (p :: Type -> Type) where
#

An affine space is roughly a vector space in which we have forgotten or at least pretend to have forgotten the origin.

a .+^ (b .-. a)  =  b@
(a .+^ u) .+^ v  =  a .+^ (u ^+^ v)@
(a .-. b) ^+^ v  =  (a .+^ v) .-. q@

Associated types

Methods

  • (.-.) :: Num a => p a -> p a -> Diff p ainfixl 6

    Get the difference between two points as a vector offset.

  • (.+^) :: Num a => p a -> Diff p a -> p ainfixl 6

    Add a vector offset to a point.

  • (.-^) :: Num a => p a -> Diff p a -> p ainfixl 6

    Subtract a vector offset from a point.

Instances20Affine, …
valueqdA :: (Affine p, Foldable (Diff p), Num a) => p a -> p a -> a
#

Compute the quadrance of the difference (the square of the distance)

newtypenewtype Point (f :: Type -> Type) a
#

A handy wrapper to help distinguish points from vectors at the type level

Constructors

  • P (f a)
Instances60Generic1, Monad, Functor, Applicative, Foldable, Traversable, …
value(.#) :: Coercible b a => (b -> c) -> (a -> b) -> a -> c
#
value(#.) :: Coercible c b => (b -> c) -> (a -> b) -> a -> c
#