Copyright | (c) Jann Müller 2018 |
---|---|
License | MIT |
Maintainer | Jann Müller <j.mueller.11@alumni.ucl.ac.uk> |
Stability | experimental |
Portability | non-portable |
Safe Haskell | Safe |
Language | Haskell2010 |
Type classes for scales. A scale is a family of functions that are parameterised by a target range (for example, the dimensions of the diagram in pixels) and an additional set of options specific to each scale.
In h3
, Scalable
is the type class that represents scales.
Scales used for visualisation commonly have metadata such as legends, grid
lines etc. The ChartVisuals
class deals with this kind of
data.
Synopsis
- class Scalable (f :: * -> *) a b where
- type Target f :: * -> *
- type TargetRange f b :: *
- data ScaleOptions f a b :: *
- arrow :: (a -> b) -> ScaleOptions ((->) a) a b
Scales
class Scalable (f :: * -> *) a b where Source #
The class of scales. Each scale has an associated data type ScaleOptions
that can be used to configure the scale.
type Target f :: * -> * Source #
Target
f
is the codomain of the scale. For example, if f
is a scale
that maps real numbers to real numbers, then Target
f
is
Identity
(a point). If it is an ordinal scale, then
Target
f
is Extent
(an interval).
type TargetRange f b :: * Source #
TargetRange
f
is the type of the range parameter of the scale. For
example, if f
is a scale that maps real numbers to real numbers, then
TargetRange
f
is Extent
(an interval). For ordinal scales,
Target
f
is []
, a list of possible values.
data ScaleOptions f a b :: * Source #
Additional parameters for the scale (other than target range).
scale :: ScaleOptions f a b -> TargetRange f b -> a -> Target f b Source #
Given ScaleOptions
and a TargetRange
, produce a map 'a -> (Target f)
b'.
Instances
Basic instances
arrow :: (a -> b) -> ScaleOptions ((->) a) a b Source #
Every function 'f :: a -> b' is a scale