h3-core-0.0.1: Core library for h3

Copyright(c) Jann Müller 2018
LicenseMIT
MaintainerJann Müller <j.mueller.11@alumni.ucl.ac.uk>
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Data.H3.Scales

Contents

Description

A set of useful scales for visualising data. Each scale is identified by an empty data type (Continuous, Ordinal etc). To use a scale f to map as to bs you need to construct a value of ScaleOptions f a b. To make this easier, a constructor such as continuous, ordinal, etc. is provided for each scale.

Scales can be combined in a number of ways, just like to ordinary functions. For example, we can take the Product of any two scales f and g. The ScaleOptions of combined scales are usually functions of the ScaleOptions of their components, and can be constructed in the same way.

Synopsis

Basic scales

arrow :: (a -> b) -> ScaleOptions ((->) a) a b Source #

Every function 'f :: a -> b' is a scale

continuous Source #

Arguments

:: Extent a

The source range

-> IncludeZeroPolicy

Whether to extend the source range to include 0

-> ScaleOptions Continuous a a 

Create a continuous scale (map between real numbers).

data Continuous a Source #

Instances
(Ord a, RealFrac a, Floating a) => Scalable Continuous a a Source # 
Instance details

Defined in Data.H3.Scales

Associated Types

type Target Continuous :: * -> * Source #

type TargetRange Continuous a :: * Source #

data ScaleOptions Continuous a a :: * Source #

(Ord a, RealFrac a, Floating a) => ChartVisuals (Vis (ScaleOptions Continuous a a)) (Extent a) a Source # 
Instance details

Defined in Data.H3.Visuals

type Target Continuous Source # 
Instance details

Defined in Data.H3.Scales

type TargetRange Continuous a Source # 
Instance details

Defined in Data.H3.Scales

data ScaleOptions Continuous a a Source # 
Instance details

Defined in Data.H3.Scales

data IncludeZeroPolicy Source #

Indicates whether to extend the source (domain) of a continuous scale to include 0.

Extending the scale to 0 ensures that absolute values are comparable but may obscure differences between values if the variation of the data is small compared to its absolute size.

cardinal :: Extent a -> ScaleOptions Cardinal a Double Source #

Create a cardinal scale (map from integers to Double).

ordinal Source #

Arguments

:: NonEmpty a

The domain

-> (a -> String)

A description of the values (for creating labels)

-> ScaleOptions Ordinal a Double 

Create an ordinal scale (map from some type with an Ord instance to 'Extent Double').

data Ordinal a Source #

Instances
(Ord a, Eq a) => Scalable Ordinal a Double Source # 
Instance details

Defined in Data.H3.Scales

Associated Types

type Target Ordinal :: * -> * Source #

type TargetRange Ordinal Double :: * Source #

data ScaleOptions Ordinal a Double :: * Source #

(Ord a, Eq a) => ChartVisuals (Vis (ScaleOptions Ordinal a Double)) (Extent Double) Double Source # 
Instance details

Defined in Data.H3.Visuals

type Target Ordinal Source # 
Instance details

Defined in Data.H3.Scales

type TargetRange Ordinal Double Source # 
Instance details

Defined in Data.H3.Scales

data ScaleOptions Ordinal a Double Source # 
Instance details

Defined in Data.H3.Scales

Combinators

product :: ScaleOptions f a b -> ScaleOptions g c d -> ScaleOptions (Product f g) (a, c) (b, d) Source #

The product of two scales.

newtype Product f g a Source #

Constructors

Product 

Fields

Instances
(Scalable f a b, Scalable g c d) => Scalable (Product f g) (a, c) (b, d) Source # 
Instance details

Defined in Data.H3.Scales

Associated Types

type Target (Product f g) :: * -> * Source #

type TargetRange (Product f g) (b, d) :: * Source #

data ScaleOptions (Product f g) (a, c) (b, d) :: * Source #

Methods

scale :: ScaleOptions (Product f g) (a, c) (b, d) -> TargetRange (Product f g) (b, d) -> (a, c) -> Target (Product f g) (b, d) Source #

type Target (Product f g) Source # 
Instance details

Defined in Data.H3.Scales

type Target (Product f g) = Product (Target f) (Target g)
type TargetRange (Product f g) (b, d) Source # 
Instance details

Defined in Data.H3.Scales

type TargetRange (Product f g) (b, d) = (TargetRange f b, TargetRange g d)
data ScaleOptions (Product f g) (a, c) (b, d) Source # 
Instance details

Defined in Data.H3.Scales

data ScaleOptions (Product f g) (a, c) (b, d) = ProdScaleOpts (ScaleOptions f a b) (ScaleOptions g c d)

nested :: ScaleOptions f a b -> ScaleOptions g c b -> ScaleOptions (Nested f g) (a, c) b Source #

nested takes two scales g and f and creates a g scale within each f result. This requires 'Target f', Target g and TargetRange g to be identical.

data Nested (f :: * -> *) (g :: * -> *) p Source #

Instances
(h ~ TargetRange g b, ChartVisuals (Vis (ScaleOptions f a b)) h b) => ChartVisuals (Vis (ScaleOptions (Nested f g) (a, c) b)) h b Source # 
Instance details

Defined in Data.H3.Visuals

Methods

visuals :: Vis (ScaleOptions (Nested f g) (a, c) b) -> h -> VisualElements String b Source #

(Target g b ~ TargetRange g b, Target f b ~ TargetRange g b, Scalable f a b, Scalable g c b) => Scalable (Nested f g) (a, c) b Source # 
Instance details

Defined in Data.H3.Scales

Associated Types

type Target (Nested f g) :: * -> * Source #

type TargetRange (Nested f g) b :: * Source #

data ScaleOptions (Nested f g) (a, c) b :: * Source #

Methods

scale :: ScaleOptions (Nested f g) (a, c) b -> TargetRange (Nested f g) b -> (a, c) -> Target (Nested f g) b Source #

type Target (Nested f g) Source # 
Instance details

Defined in Data.H3.Scales

type Target (Nested f g) = Target f
type TargetRange (Nested f g) b Source # 
Instance details

Defined in Data.H3.Scales

type TargetRange (Nested f g) b = TargetRange f b
data ScaleOptions (Nested f g) (a, c) b Source # 
Instance details

Defined in Data.H3.Scales

data ScaleOptions (Nested f g) (a, c) b = NestScaleOpts (ScaleOptions f a b) (ScaleOptions g c b)

transformed :: (Target f b -> Target f b) -> ScaleOptions f a b -> ScaleOptions (Transformed f) a b Source #

Map the results of a scale monomorphically.

data Transformed (f :: * -> *) a Source #

Instances
(Target f b ~ h b, Functor h, Scalable f a b) => Scalable (Transformed f) a b Source # 
Instance details

Defined in Data.H3.Scales

Associated Types

type Target (Transformed f) :: * -> * Source #

type TargetRange (Transformed f) b :: * Source #

data ScaleOptions (Transformed f) a b :: * Source #

(h ~ TargetRange f b, ChartVisuals (Vis (ScaleOptions f a b)) h b) => ChartVisuals (Vis (ScaleOptions (Transformed f) a b)) h b Source # 
Instance details

Defined in Data.H3.Visuals

type Target (Transformed f) Source # 
Instance details

Defined in Data.H3.Scales

data ScaleOptions (Transformed f) a b Source # 
Instance details

Defined in Data.H3.Scales

type TargetRange (Transformed f) b Source # 
Instance details

Defined in Data.H3.Scales

anchored :: a -> ScaleOptions f a b -> ScaleOptions (Anchored f) a b Source #

Extend a scale by "anchoring" its results to a fixed point of the domain

data Anchored (f :: * -> *) a Source #

Instances
(Applicative (Target f), Scalable f a b) => Scalable (Anchored f) a b Source # 
Instance details

Defined in Data.H3.Scales

Associated Types

type Target (Anchored f) :: * -> * Source #

type TargetRange (Anchored f) b :: * Source #

data ScaleOptions (Anchored f) a b :: * Source #

Methods

scale :: ScaleOptions (Anchored f) a b -> TargetRange (Anchored f) b -> a -> Target (Anchored f) b Source #

(h ~ TargetRange f b, ChartVisuals (Vis (ScaleOptions f a b)) h b) => ChartVisuals (Vis (ScaleOptions (Anchored f) a b)) h b Source # 
Instance details

Defined in Data.H3.Visuals

type Target (Anchored f) Source # 
Instance details

Defined in Data.H3.Scales

data ScaleOptions (Anchored f) a b Source # 
Instance details

Defined in Data.H3.Scales

type TargetRange (Anchored f) b Source # 
Instance details

Defined in Data.H3.Scales

split :: ScaleOptions f a b -> ScaleOptions g a c -> ScaleOptions (Split f g) a (b, c) Source #

Apply two scales to the same value

data Split (f :: * -> *) (g :: * -> *) a Source #

Instances
(Scalable f a b, Scalable g a c) => Scalable (Split f g) a (b, c) Source # 
Instance details

Defined in Data.H3.Scales

Associated Types

type Target (Split f g) :: * -> * Source #

type TargetRange (Split f g) (b, c) :: * Source #

data ScaleOptions (Split f g) a (b, c) :: * Source #

Methods

scale :: ScaleOptions (Split f g) a (b, c) -> TargetRange (Split f g) (b, c) -> a -> Target (Split f g) (b, c) Source #

type Target (Split f g) Source # 
Instance details

Defined in Data.H3.Scales

type Target (Split f g) = Product (Target f) (Target g)
data ScaleOptions (Split f g) a (b, c) Source # 
Instance details

Defined in Data.H3.Scales

data ScaleOptions (Split f g) a (b, c) = SplitScaleOpts (ScaleOptions f a b) (ScaleOptions g a c)
type TargetRange (Split f g) (b, c) Source # 
Instance details

Defined in Data.H3.Scales

type TargetRange (Split f g) (b, c) = (TargetRange f b, TargetRange g c)

newtype Pair a Source #

Constructors

Pair 

Fields

class ProductV p Source #

A type that is the result of a binary function

Instances
ProductV Void Source # 
Instance details

Defined in Data.H3.Scales

Associated Types

type LeftV Void :: *

type RightV Void :: *

ProductV (Either a b) Source # 
Instance details

Defined in Data.H3.Scales

Associated Types

type LeftV (Either a b) :: *

type RightV (Either a b) :: *

ProductV (a, b) Source # 
Instance details

Defined in Data.H3.Scales

Associated Types

type LeftV (a, b) :: *

type RightV (a, b) :: *

Data family instance constructors

data family ScaleOptions f a b :: * Source #

Additional parameters for the scale (other than target range).

Instances
(h ~ TargetRange f b, ChartVisuals (Vis (ScaleOptions f a b)) h b) => ChartVisuals (Vis (ScaleOptions (Anchored f) a b)) h b Source # 
Instance details

Defined in Data.H3.Visuals

(h ~ TargetRange f b, ChartVisuals (Vis (ScaleOptions f a b)) h b) => ChartVisuals (Vis (ScaleOptions (Transformed f) a b)) h b Source # 
Instance details

Defined in Data.H3.Visuals

(h ~ TargetRange g b, ChartVisuals (Vis (ScaleOptions f a b)) h b) => ChartVisuals (Vis (ScaleOptions (Nested f g) (a, c) b)) h b Source # 
Instance details

Defined in Data.H3.Visuals

Methods

visuals :: Vis (ScaleOptions (Nested f g) (a, c) b) -> h -> VisualElements String b Source #

(h ~ TargetRange f b, Scalable f a b) => ChartVisuals (Vis (ScaleOptions (NoVisuals f) a b)) h b Source # 
Instance details

Defined in Data.H3.Visuals

(h ~ TargetRange f b, ChartVisuals (Vis (ScaleOptions f a b)) h b) => ChartVisuals (Vis (ScaleOptions (NoGrid f) a b)) h b Source # 
Instance details

Defined in Data.H3.Visuals

Methods

visuals :: Vis (ScaleOptions (NoGrid f) a b) -> h -> VisualElements String b Source #

(Ord a, Eq a) => ChartVisuals (Vis (ScaleOptions Ordinal a Double)) (Extent Double) Double Source # 
Instance details

Defined in Data.H3.Visuals

(Ord a, Integral a) => ChartVisuals (Vis (ScaleOptions Cardinal a Double)) (Extent Double) Double Source # 
Instance details

Defined in Data.H3.Visuals

(Ord a, RealFrac a, Floating a) => ChartVisuals (Vis (ScaleOptions Continuous a a)) (Extent a) a Source # 
Instance details

Defined in Data.H3.Visuals

(TargetRange f b ~ h b, TargetRange g d ~ h d, h ~ Extent, Num d, Num b, ChartVisuals (Vis (ScaleOptions g c d)) (h d) d, ChartVisuals (Vis (ScaleOptions f a b)) (h b) b) => ChartVisuals (Vis (ScaleOptions (Cartesian f g) (a, c) (b, d))) (h b, h d) (b, d) Source # 
Instance details

Defined in Data.H3.Visuals

Methods

visuals :: Vis (ScaleOptions (Cartesian f g) (a, c) (b, d)) -> (h b, h d) -> VisualElements String (b, d) Source #

data ScaleOptions Ordinal a Double Source # 
Instance details

Defined in Data.H3.Scales

data ScaleOptions Cardinal a Double Source # 
Instance details

Defined in Data.H3.Scales

data ScaleOptions Continuous a a Source # 
Instance details

Defined in Data.H3.Scales

data ScaleOptions (Anchored f) a b Source # 
Instance details

Defined in Data.H3.Scales

data ScaleOptions (Transformed f) a b Source # 
Instance details

Defined in Data.H3.Scales

data ScaleOptions (NoVisuals f) a b Source # 
Instance details

Defined in Data.H3.Visuals

data ScaleOptions (NoGrid f) a b Source # 
Instance details

Defined in Data.H3.Visuals

data ScaleOptions (NoGrid f) a b = NoGrid (ScaleOptions f a b)
data ScaleOptions (Split f g) a (b, c) Source # 
Instance details

Defined in Data.H3.Scales

data ScaleOptions (Split f g) a (b, c) = SplitScaleOpts (ScaleOptions f a b) (ScaleOptions g a c)
data ScaleOptions (Nested f g) (a, c) b Source # 
Instance details

Defined in Data.H3.Scales

data ScaleOptions (Nested f g) (a, c) b = NestScaleOpts (ScaleOptions f a b) (ScaleOptions g c b)
data ScaleOptions (Product f g) (a, c) (b, d) Source # 
Instance details

Defined in Data.H3.Scales

data ScaleOptions (Product f g) (a, c) (b, d) = ProdScaleOpts (ScaleOptions f a b) (ScaleOptions g c d)
data ScaleOptions (Cartesian f g) (a, c) (b, d) Source # 
Instance details

Defined in Data.H3.Visuals

data ScaleOptions ((->) a :: * -> *) a b Source # 
Instance details

Defined in Data.H3.Scalable

data ScaleOptions ((->) a :: * -> *) a b = ArrScaleOpts (a -> b)