glaze-0.2.0.2: Framework for rendering things with metadata/headers and values

Safe HaskellNone
LanguageHaskell2010

Glaze

Description

Framework for rendering things (or list of things, or things that contain things) that have metadata/header information as well as values.

Synopsis

Documentation

data Glaze a r Source #

Glaze is something that knows how to render some header information and given a value, how to render the value. Ie, the value has been glaze with meta information.

Constructors

Glaze 

Fields

Instances

Functor (Glaze a) Source # 

Methods

fmap :: (a -> b) -> Glaze a a -> Glaze a b #

(<$) :: a -> Glaze a b -> Glaze a a #

Applicative (Glaze a) Source # 

Methods

pure :: a -> Glaze a a #

(<*>) :: Glaze a (a -> b) -> Glaze a a -> Glaze a b #

(*>) :: Glaze a a -> Glaze a b -> Glaze a b #

(<*) :: Glaze a a -> Glaze a b -> Glaze a a #

HasRenderedMeta (Glaze a r) r Source # 

Methods

renderedMeta :: Lens' (Glaze a r) r Source #

HasValueRenderer (Glaze a r) (a -> r) Source # 

Methods

valueRenderer :: Lens' (Glaze a r) (a -> r) Source #

class HasRenderedMeta s a | s -> a where Source #

Minimal complete definition

renderedMeta

Methods

renderedMeta :: Lens' s a Source #

Instances

class HasValueRenderer s a | s -> a where Source #

Minimal complete definition

valueRenderer

Methods

valueRenderer :: Lens' s a Source #

Instances

HasValueRenderer (Glaze a r) (a -> r) Source # 

Methods

valueRenderer :: Lens' (Glaze a r) (a -> r) Source #

renderWith :: (r -> r -> b) -> Glaze a r -> a -> b Source #

Given a wrapping function for the meta and renderer value, and Glaze instructions for a, run them all together.

glazeA :: (Traversable t, Applicative m) => (wrapper -> meta -> t rs -> r) -> m wrapper -> m meta -> t (m rs) -> m r Source #

Lifts glazing function into an Applicative

glazeList :: ([row] -> r, [field] -> row, [field] -> row) -> r -> [Glaze a field] -> Glaze [a] r Source #

This can be used to make a Glaze for a list of things to render as a table. Given (mainWrapper :: rows -> final render, headerRowWrapper:: fields -> header row, valueRowWrapper -> value row) the rendered meta, and a list of Glaze a, transform it to a Glaze for a list of as.

glazeListA :: Applicative f => f ([row] -> r, [field] -> row, [field] -> row) -> f r -> [f (Glaze a field)] -> f (Glaze [a] r) Source #

Applicative version of glazeList

glazeFields :: ([(b, b)] -> r) -> r -> [Glaze a b] -> Glaze a r Source #

This can be used to generate a Glaze for a larger supercomponent. Given (wrapper :: list of (meta, rendered value) to final render) the rendered meta, and a list of Glaze a, transform it to a Glaze for a single a. In this case, use reglaze to generate Glaze a for each subcomponent to use as the list of Glaze a

glazeFieldsA :: Applicative f => f ([(b, b)] -> r) -> f r -> [f (Glaze a b)] -> f (Glaze a r) Source #

Applicative versino of glazeFields

reglaze :: (Proxy a -> Glaze a r) -> Getter s a -> Glaze s r Source #

Makes a glaze of the type of a larger component, but only using the information of a smaller component. Given a factory function that can create glazes from Proxy a and a Lens into subcomponent a, create the glaze of the type of the larger component.

reglazeA :: Applicative f => (Proxy a -> f (Glaze a r)) -> Getter s a -> f (Glaze s r) Source #

Applicative version of reglaze