HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Modulenumeric-prelude-0.4.4Haskell98

Algebra.OccasionallyScalar

There are several types of numbers where a subset of numbers can be considered as set of scalars.

  • A '(Complex.T Double)' value can be converted to Double if the imaginary part is zero.

  • A value with physical units can be converted to a scalar if there is no unit.

Of course this can be cascaded, e.g. a complex number with physical units can be converted to a scalar if there is both no imaginary part and no unit.

This is somewhat similar to the multi-type classes NormedMax.C and friends.

I hesitate to define an instance for lists to avoid the mess known of MatLab. But if you have an application where you think you need this instance definitely I'll think about that, again.

  • 1 class
  • 2 values
classclass C a v where
#

Methods

Instances8C, …
  • C Double DoubleDefined in numeric-prelude-0.4.4 · Algebra.OccasionallyScalar
  • C Float FloatDefined in numeric-prelude-0.4.4 · Algebra.OccasionallyScalar
  • (Show v, C v, C v, C a v) => C a (T v)Defined in numeric-prelude-0.4.4 · Number.Complex
  • C a v => C a (T i v)Defined in numeric-prelude-0.4.4 · Number.Physical
  • (IsScalar u, C a b) => C a (T u b)Defined in numeric-prelude-0.4.4 · Number.DimensionTerm
  • (C a v, Show v) => C a (T a v)Defined in numeric-prelude-0.4.4 · Number.OccasionallyScalarExpression
  • (C a, Ord a, C a v, Show v, C a v) => C a (T a v)Defined in numeric-prelude-0.4.4 · Number.SI
  • C a v => C (T a) (T v)Defined in numeric-prelude-0.4.4 · MathObj.Wrapper.NumericPrelude