I have a concept of scale that converts an input domain and an output range. However, there are several types of scales; each of them supports a subset of the possible operations and preserves a slightly different range.
For instance:
A ContinuousScale ( Scale (Float, Float) (Float, Float)), which has a domain (Float, Float), and the range (Float, Float)supports:
convert : Continuous -> Float -> Float convert a value from a domain to a range.invert : Continuous -> Float -> Float converts a value from a range back to a domain.domain : Continuous -> (Float, Float) return domain.ticks : Continuous -> List Float returns values suitable for drawing on an axis.
A mask Sequentialhas a scope (Float, Float)and function out Float -> a; it usually does not make much sense to store a range.
convert : Sequential a -> Float -> a converts a value from a domain to a range.domain : Sequential a -> (Float, Float) return domain.
ScaleA Quantile (List Float) (List a). ; .
convert : Quantile a -> Float -> a .invertExtent : Quantile a -> a -> (Float, Float) , .
, . , , , . , . "" , (.. identity) , . , .
API Elm?
, :
- , , . .
- , , / , . API . .
- -
Scale supportsOp1 supportsOp2 supportsOp3, SupportsOp Doesnt. , . op1 : Scale SupportsOp a b -> c. , . , . - ad hoc. , . . API - , .