Safe Haskell | None |
---|---|
Language | Haskell2010 |
Most users of this library do not need this module. The functions
here are used to build functions that apply a Colonnade
to a collection of values, building a table from them. Ultimately,
a function that applies a Colonnade Headed MyCell a
to data will have roughly the following type:
myTableRenderer :: Foldable g => Colonnade Headed MyCell a -> g a -> MyContent
In the companion packages yesod-colonnade
and
reflex-dom-colonnade
, functions with
similar type signatures are readily available.
These packages use the functions provided here
in the implementations of their rendering functions.
It is recommended that users who believe they may need
this module look at the source of the companion packages
to see an example of how this module's functions are used.
Other backends are encouraged to use these functions
to build monadic or monoidal content from a Colonnade
.
The functions exported here take a Colonnade
and
convert it to a fragment of content. The functions whose
names start with row
take at least a Colonnade f c a
and an a
value to generate a row of content. The functions whose names
start with header
need the Colonnade f c a
but not
an a
value since a value is not needed to build a header.
- row :: (c1 -> c2) -> Colonnade f c1 a -> a -> Vector c2
- rowMonadic :: (Monad m, Monoid b) => Colonnade f content a -> (content -> m b) -> a -> m b
- rowMonadic_ :: Monad m => Colonnade f content a -> (content -> m b) -> a -> m ()
- rowMonadicWith :: Monad m => b -> (b -> b -> b) -> Colonnade f content a -> (content -> m b) -> a -> m b
- rowMonoidal :: Monoid m => Colonnade h c a -> (c -> m) -> a -> m
- header :: (c1 -> c2) -> Colonnade Headed c1 a -> Vector c2
- headerMonadic :: (Monad m, Monoid b) => Colonnade Headed content a -> (content -> m b) -> m b
- headerMonadic_ :: Monad m => Colonnade Headed content a -> (content -> m b) -> m ()
- headerMonadicGeneral :: (Monad m, Monoid b, Foldable h) => Colonnade h content a -> (content -> m b) -> m b
- headerMonadicGeneral_ :: (Monad m, Foldable h) => Colonnade h content a -> (content -> m b) -> m ()
- headerMonoidalGeneral :: (Monoid m, Foldable h) => Colonnade h c a -> (c -> m) -> m
- bothMonadic_ :: Monad m => Colonnade Headed content a -> (content -> content -> m b) -> a -> m ()
Documentation
row :: (c1 -> c2) -> Colonnade f c1 a -> a -> Vector c2 Source #
Consider providing a variant the produces a list instead. It may allow more things to get inlined in to a loop.
rowMonadic_ :: Monad m => Colonnade f content a -> (content -> m b) -> a -> m () Source #
rowMonadicWith :: Monad m => b -> (b -> b -> b) -> Colonnade f content a -> (content -> m b) -> a -> m b Source #
rowMonoidal :: Monoid m => Colonnade h c a -> (c -> m) -> a -> m Source #
headerMonadic :: (Monad m, Monoid b) => Colonnade Headed content a -> (content -> m b) -> m b Source #
headerMonadicGeneral :: (Monad m, Monoid b, Foldable h) => Colonnade h content a -> (content -> m b) -> m b Source #
This function is a helper for abusing Foldable
to optionally
render a header. Its future is uncertain.