nice-html-0.3.0: A fast and nice HTML templating library with distinct compilation/rendering phases.

Safe HaskellNone
LanguageHaskell2010

Text.Html.Nice.Internal

Synopsis

Documentation

data Attr a Source #

Constructors

(:=) 

Fields

(:-) 

Fields

Instances

Functor Attr Source # 

Methods

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

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

Foldable Attr Source # 

Methods

fold :: Monoid m => Attr m -> m #

foldMap :: Monoid m => (a -> m) -> Attr a -> m #

foldr :: (a -> b -> b) -> b -> Attr a -> b #

foldr' :: (a -> b -> b) -> b -> Attr a -> b #

foldl :: (b -> a -> b) -> b -> Attr a -> b #

foldl' :: (b -> a -> b) -> b -> Attr a -> b #

foldr1 :: (a -> a -> a) -> Attr a -> a #

foldl1 :: (a -> a -> a) -> Attr a -> a #

toList :: Attr a -> [a] #

null :: Attr a -> Bool #

length :: Attr a -> Int #

elem :: Eq a => a -> Attr a -> Bool #

maximum :: Ord a => Attr a -> a #

minimum :: Ord a => Attr a -> a #

sum :: Num a => Attr a -> a #

product :: Num a => Attr a -> a #

Traversable Attr Source # 

Methods

traverse :: Applicative f => (a -> f b) -> Attr a -> f (Attr b) #

sequenceA :: Applicative f => Attr (f a) -> f (Attr a) #

mapM :: Monad m => (a -> m b) -> Attr a -> m (Attr b) #

sequence :: Monad m => Attr (m a) -> m (Attr a) #

Eq a => Eq (Attr a) Source # 

Methods

(==) :: Attr a -> Attr a -> Bool #

(/=) :: Attr a -> Attr a -> Bool #

Show a => Show (Attr a) Source # 

Methods

showsPrec :: Int -> Attr a -> ShowS #

show :: Attr a -> String #

showList :: [Attr a] -> ShowS #

data Markup' a Source #

A very simple HTML DSL

Instances

Functor Markup' Source # 

Methods

fmap :: (a -> b) -> Markup' a -> Markup' b #

(<$) :: a -> Markup' b -> Markup' a #

Foldable Markup' Source # 

Methods

fold :: Monoid m => Markup' m -> m #

foldMap :: Monoid m => (a -> m) -> Markup' a -> m #

foldr :: (a -> b -> b) -> b -> Markup' a -> b #

foldr' :: (a -> b -> b) -> b -> Markup' a -> b #

foldl :: (b -> a -> b) -> b -> Markup' a -> b #

foldl' :: (b -> a -> b) -> b -> Markup' a -> b #

foldr1 :: (a -> a -> a) -> Markup' a -> a #

foldl1 :: (a -> a -> a) -> Markup' a -> a #

toList :: Markup' a -> [a] #

null :: Markup' a -> Bool #

length :: Markup' a -> Int #

elem :: Eq a => a -> Markup' a -> Bool #

maximum :: Ord a => Markup' a -> a #

minimum :: Ord a => Markup' a -> a #

sum :: Num a => Markup' a -> a #

product :: Num a => Markup' a -> a #

Eq a => Eq (Markup' a) Source # 

Methods

(==) :: Markup' a -> Markup' a -> Bool #

(/=) :: Markup' a -> Markup' a -> Bool #

Show a => Show (Markup' a) Source # 

Methods

showsPrec :: Int -> Markup' a -> ShowS #

show :: Markup' a -> String #

showList :: [Markup' a] -> ShowS #

Recursive (Markup' a0) Source # 

Methods

project :: Markup' a0 -> Base (Markup' a0) (Markup' a0) #

cata :: (Base (Markup' a0) a -> a) -> Markup' a0 -> a #

para :: (Base (Markup' a0) (Markup' a0, a) -> a) -> Markup' a0 -> a #

gpara :: (Corecursive (Markup' a0), Comonad w) => (forall b. Base (Markup' a0) (w b) -> w (Base (Markup' a0) b)) -> (Base (Markup' a0) (EnvT (Markup' a0) w a) -> a) -> Markup' a0 -> a #

prepro :: Corecursive (Markup' a0) => (forall b. Base (Markup' a0) b -> Base (Markup' a0) b) -> (Base (Markup' a0) a -> a) -> Markup' a0 -> a #

gprepro :: (Corecursive (Markup' a0), Comonad w) => (forall b. Base (Markup' a0) (w b) -> w (Base (Markup' a0) b)) -> (forall c. Base (Markup' a0) c -> Base (Markup' a0) c) -> (Base (Markup' a0) (w a) -> a) -> Markup' a0 -> a #

Corecursive (Markup' a0) Source # 

Methods

embed :: Base (Markup' a0) (Markup' a0) -> Markup' a0 #

ana :: (a -> Base (Markup' a0) a) -> a -> Markup' a0 #

apo :: (a -> Base (Markup' a0) (Either (Markup' a0) a)) -> a -> Markup' a0 #

postpro :: Recursive (Markup' a0) => (forall b. Base (Markup' a0) b -> Base (Markup' a0) b) -> (a -> Base (Markup' a0) a) -> a -> Markup' a0 #

gpostpro :: (Recursive (Markup' a0), Monad m) => (forall b. m (Base (Markup' a0) b) -> Base (Markup' a0) (m b)) -> (forall c. Base (Markup' a0) c -> Base (Markup' a0) c) -> (a -> Base (Markup' a0) (m a)) -> a -> Markup' a0 #

type Base (Markup' a0) Source # 
type Base (Markup' a0) = Markup'F a0

data Stream a Source #

Constructors

ListS [s] !(FastMarkup (s -> a)) 

Instances

Functor Stream Source # 

Methods

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

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

Foldable Stream Source # 

Methods

fold :: Monoid m => Stream m -> m #

foldMap :: Monoid m => (a -> m) -> Stream a -> m #

foldr :: (a -> b -> b) -> b -> Stream a -> b #

foldr' :: (a -> b -> b) -> b -> Stream a -> b #

foldl :: (b -> a -> b) -> b -> Stream a -> b #

foldl' :: (b -> a -> b) -> b -> Stream a -> b #

foldr1 :: (a -> a -> a) -> Stream a -> a #

foldl1 :: (a -> a -> a) -> Stream a -> a #

toList :: Stream a -> [a] #

null :: Stream a -> Bool #

length :: Stream a -> Int #

elem :: Eq a => a -> Stream a -> Bool #

maximum :: Ord a => Stream a -> a #

minimum :: Ord a => Stream a -> a #

sum :: Num a => Stream a -> a #

product :: Num a => Stream a -> a #

Eq (Stream a) Source #

Don't use this! It's a lie!

Methods

(==) :: Stream a -> Stream a -> Bool #

(/=) :: Stream a -> Stream a -> Bool #

Show a => Show (Stream a) Source # 

Methods

showsPrec :: Int -> Stream a -> ShowS #

show :: Stream a -> String #

showList :: [Stream a] -> ShowS #

NFData a => NFData (Stream a) Source # 

Methods

rnf :: Stream a -> () #

unstream :: (FastMarkup a -> b) -> Stream a -> (b -> c -> c) -> c -> c Source #

data a :$ b infixl 0 Source #

Constructors

(:$) (FastMarkup (a -> b)) a infixl 0 

Instances

Functor ((:$) a) Source # 

Methods

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

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

Show a => Show ((:$) a b) Source # 

Methods

showsPrec :: Int -> (a :$ b) -> ShowS #

show :: (a :$ b) -> String #

showList :: [a :$ b] -> ShowS #

(Monad m, Render b m) => Render ((:$) a b) m Source #

Defer application of an argument to rendering

Methods

r :: (a :$ b) -> m Builder Source #

data FastMarkup a Source #

Instances

Functor FastMarkup Source # 

Methods

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

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

Foldable FastMarkup Source # 

Methods

fold :: Monoid m => FastMarkup m -> m #

foldMap :: Monoid m => (a -> m) -> FastMarkup a -> m #

foldr :: (a -> b -> b) -> b -> FastMarkup a -> b #

foldr' :: (a -> b -> b) -> b -> FastMarkup a -> b #

foldl :: (b -> a -> b) -> b -> FastMarkup a -> b #

foldl' :: (b -> a -> b) -> b -> FastMarkup a -> b #

foldr1 :: (a -> a -> a) -> FastMarkup a -> a #

foldl1 :: (a -> a -> a) -> FastMarkup a -> a #

toList :: FastMarkup a -> [a] #

null :: FastMarkup a -> Bool #

length :: FastMarkup a -> Int #

elem :: Eq a => a -> FastMarkup a -> Bool #

maximum :: Ord a => FastMarkup a -> a #

minimum :: Ord a => FastMarkup a -> a #

sum :: Num a => FastMarkup a -> a #

product :: Num a => FastMarkup a -> a #

Eq a => Eq (FastMarkup a) Source # 

Methods

(==) :: FastMarkup a -> FastMarkup a -> Bool #

(/=) :: FastMarkup a -> FastMarkup a -> Bool #

Show a => Show (FastMarkup a) Source # 
Generic (FastMarkup a) Source # 

Associated Types

type Rep (FastMarkup a) :: * -> * #

Methods

from :: FastMarkup a -> Rep (FastMarkup a) x #

to :: Rep (FastMarkup a) x -> FastMarkup a #

Monoid (FastMarkup a) Source # 
NFData a => NFData (FastMarkup a) Source # 

Methods

rnf :: FastMarkup a -> () #

(Render a m, Monad m) => Render (FastMarkup a) m Source # 

Methods

r :: FastMarkup a -> m Builder Source #

type Rep (FastMarkup a) Source # 

data Markup'F a r Source #

Instances

Bifunctor Markup'F Source # 

Methods

bimap :: (a -> b) -> (c -> d) -> Markup'F a c -> Markup'F b d #

first :: (a -> b) -> Markup'F a c -> Markup'F b c #

second :: (b -> c) -> Markup'F a b -> Markup'F a c #

Functor (Markup'F a0) Source # 

Methods

fmap :: (a -> b) -> Markup'F a0 a -> Markup'F a0 b #

(<$) :: a -> Markup'F a0 b -> Markup'F a0 a #

Foldable (Markup'F a0) Source # 

Methods

fold :: Monoid m => Markup'F a0 m -> m #

foldMap :: Monoid m => (a -> m) -> Markup'F a0 a -> m #

foldr :: (a -> b -> b) -> b -> Markup'F a0 a -> b #

foldr' :: (a -> b -> b) -> b -> Markup'F a0 a -> b #

foldl :: (b -> a -> b) -> b -> Markup'F a0 a -> b #

foldl' :: (b -> a -> b) -> b -> Markup'F a0 a -> b #

foldr1 :: (a -> a -> a) -> Markup'F a0 a -> a #

foldl1 :: (a -> a -> a) -> Markup'F a0 a -> a #

toList :: Markup'F a0 a -> [a] #

null :: Markup'F a0 a -> Bool #

length :: Markup'F a0 a -> Int #

elem :: Eq a => a -> Markup'F a0 a -> Bool #

maximum :: Ord a => Markup'F a0 a -> a #

minimum :: Ord a => Markup'F a0 a -> a #

sum :: Num a => Markup'F a0 a -> a #

product :: Num a => Markup'F a0 a -> a #

Traversable (Markup'F a0) Source # 

Methods

traverse :: Applicative f => (a -> f b) -> Markup'F a0 a -> f (Markup'F a0 b) #

sequenceA :: Applicative f => Markup'F a0 (f a) -> f (Markup'F a0 a) #

mapM :: Monad m => (a -> m b) -> Markup'F a0 a -> m (Markup'F a0 b) #

sequence :: Monad m => Markup'F a0 (m a) -> m (Markup'F a0 a) #

MonadFree (Markup'F n) (Markup n) # 

Methods

wrap :: Markup'F n (Markup n a) -> Markup n a #

plateFM :: Monad m => (FastMarkup a -> m (FastMarkup a)) -> FastMarkup a -> m (FastMarkup a) Source #

Unlike plate, this uses Monad. That's because traverse over Vector is really quite slow.

compileAttrs :: forall a. Vector (Attr a) -> (Builder, Vector (Attr a)) Source #

immediateRender :: FastMarkup a -> Maybe Builder Source #

Look for an immediate string-like term and render that

munch :: Vector (FastMarkup a) -> Vector (FastMarkup a) Source #

Flatten a vector of 'FastMarkup. String-like terms that are next to eachother should be combined

flatten :: FastMarkup a -> FastMarkup a Source #

Recursively flatten FastMarkup until doing so does nothing

strictify :: FastMarkup a -> FastMarkup a Source #

Run all Text builders

compile_ :: Markup' a -> FastMarkup a Source #

Compile Markup''

renderM :: Monad m => (a -> m Builder) -> FastMarkup a -> m Builder Source #

Render FastMarkup

renderMs :: Monad m => (a -> m (FastMarkup Void)) -> FastMarkup a -> m Builder Source #

Render FastMarkup by recursively rendering any sub-markup.

render :: FastMarkup Void -> Builder Source #

Render FastMarkup that has no holes.

class Render a m where Source #

Minimal complete definition

r

Methods

r :: a -> m Builder Source #

Instances

Monad m => Render Void m Source # 

Methods

r :: Void -> m Builder Source #

Monad m => Render Text m Source # 

Methods

r :: Text -> m Builder Source #

Monad m => Render Text m Source # 

Methods

r :: Text -> m Builder Source #

Monad m => Render Builder m Source # 

Methods

r :: Builder -> m Builder Source #

(Render a m, Monad m) => Render (FastMarkup a) m Source # 

Methods

r :: FastMarkup a -> m Builder Source #

(ToFastMarkup a, Monad m) => Render (RenderToFastMarkup a) m Source # 
(Render b m, (~) (* -> *) m' (ReaderT * a m)) => Render (a -> b) m' Source # 

Methods

r :: (a -> b) -> m' Builder Source #

(Monad m, Render b m) => Render ((:$) a b) m Source #

Defer application of an argument to rendering

Methods

r :: (a :$ b) -> m Builder Source #

newtype RenderToFastMarkup a Source #

Constructors

RenderToFastMarkup 

Fields

Instances

newtype AsDecimal a Source #

Constructors

AsDecimal 

Fields

newtype AsHex a Source #

Constructors

AsHex 

Fields

Instances

newtype AsRealFloat a Source #

Constructors

AsRealFloat 

Fields