web-rep-0.2.0: representations of a web page

Safe HaskellNone
LanguageHaskell2010

Web.Page.Types

Synopsis

Documentation

data Page Source #

Components of a web page.

A web page typically can take many forms but still be the same web page. For example, css can be linked to in a separate file, or can be inline within html, but still be the same css. This type represents the practical components of what makes up a web page.

Constructors

Page 

Fields

Instances
Show Page Source # 
Instance details

Defined in Web.Page.Types

Methods

showsPrec :: Int -> Page -> ShowS #

show :: Page -> String #

showList :: [Page] -> ShowS #

Generic Page Source # 
Instance details

Defined in Web.Page.Types

Associated Types

type Rep Page :: Type -> Type #

Methods

from :: Page -> Rep Page x #

to :: Rep Page x -> Page #

Semigroup Page Source # 
Instance details

Defined in Web.Page.Types

Methods

(<>) :: Page -> Page -> Page #

sconcat :: NonEmpty Page -> Page #

stimes :: Integral b => b -> Page -> Page #

Monoid Page Source # 
Instance details

Defined in Web.Page.Types

Methods

mempty :: Page #

mappend :: Page -> Page -> Page #

mconcat :: [Page] -> Page #

type Rep Page Source # 
Instance details

Defined in Web.Page.Types

data PageConfig Source #

Configuration of the rendering of a web page

Instances
Eq PageConfig Source # 
Instance details

Defined in Web.Page.Types

Show PageConfig Source # 
Instance details

Defined in Web.Page.Types

Generic PageConfig Source # 
Instance details

Defined in Web.Page.Types

Associated Types

type Rep PageConfig :: Type -> Type #

type Rep PageConfig Source # 
Instance details

Defined in Web.Page.Types

data Concerns a Source #

A web page typically is composed of css, javascript and html

Concerns abstracts this compositional feature of a web page.

Constructors

Concerns 

Fields

Instances
Functor Concerns Source # 
Instance details

Defined in Web.Page.Types

Methods

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

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

Applicative Concerns Source # 
Instance details

Defined in Web.Page.Types

Methods

pure :: a -> Concerns a #

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

liftA2 :: (a -> b -> c) -> Concerns a -> Concerns b -> Concerns c #

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

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

Foldable Concerns Source # 
Instance details

Defined in Web.Page.Types

Methods

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

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

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

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

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

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

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

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

toList :: Concerns a -> [a] #

null :: Concerns a -> Bool #

length :: Concerns a -> Int #

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

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

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

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

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

Traversable Concerns Source # 
Instance details

Defined in Web.Page.Types

Methods

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

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

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

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

Eq a => Eq (Concerns a) Source # 
Instance details

Defined in Web.Page.Types

Methods

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

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

Show a => Show (Concerns a) Source # 
Instance details

Defined in Web.Page.Types

Methods

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

show :: Concerns a -> String #

showList :: [Concerns a] -> ShowS #

Generic (Concerns a) Source # 
Instance details

Defined in Web.Page.Types

Associated Types

type Rep (Concerns a) :: Type -> Type #

Methods

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

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

type Rep (Concerns a) Source # 
Instance details

Defined in Web.Page.Types

type Rep (Concerns a) = D1 (MetaData "Concerns" "Web.Page.Types" "web-rep-0.2.0-FIwogXICtLkCMjX6u6XK6R" False) (C1 (MetaCons "Concerns" PrefixI True) (S1 (MetaSel (Just "cssConcern") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 a) :*: (S1 (MetaSel (Just "jsConcern") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 a) :*: S1 (MetaSel (Just "htmlConcern") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 a))))

suffixes :: Concerns FilePath Source #

the common file suffixes of the three concerns

concernNames :: FilePath -> FilePath -> Concerns FilePath Source #

create filenames for each Concern element.

data PageConcerns Source #

Is the rendering to include all Concerns or be separated?

Constructors

Inline 
Separated 
Instances
Eq PageConcerns Source # 
Instance details

Defined in Web.Page.Types

Show PageConcerns Source # 
Instance details

Defined in Web.Page.Types

Generic PageConcerns Source # 
Instance details

Defined in Web.Page.Types

Associated Types

type Rep PageConcerns :: Type -> Type #

type Rep PageConcerns Source # 
Instance details

Defined in Web.Page.Types

type Rep PageConcerns = D1 (MetaData "PageConcerns" "Web.Page.Types" "web-rep-0.2.0-FIwogXICtLkCMjX6u6XK6R" False) (C1 (MetaCons "Inline" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "Separated" PrefixI False) (U1 :: Type -> Type))

data PageStructure Source #

Various ways that a Html file can be structured.

Constructors

HeaderBody 
Headless 
Snippet 
Svg 
Instances
Eq PageStructure Source # 
Instance details

Defined in Web.Page.Types

Show PageStructure Source # 
Instance details

Defined in Web.Page.Types

Generic PageStructure Source # 
Instance details

Defined in Web.Page.Types

Associated Types

type Rep PageStructure :: Type -> Type #

type Rep PageStructure Source # 
Instance details

Defined in Web.Page.Types

type Rep PageStructure = D1 (MetaData "PageStructure" "Web.Page.Types" "web-rep-0.2.0-FIwogXICtLkCMjX6u6XK6R" False) ((C1 (MetaCons "HeaderBody" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "Headless" PrefixI False) (U1 :: Type -> Type)) :+: (C1 (MetaCons "Snippet" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "Svg" PrefixI False) (U1 :: Type -> Type)))

data PageRender Source #

Post-processing of page concerns

Constructors

Pretty 
Minified 
NoPost 
Instances
Eq PageRender Source # 
Instance details

Defined in Web.Page.Types

Show PageRender Source # 
Instance details

Defined in Web.Page.Types

Generic PageRender Source # 
Instance details

Defined in Web.Page.Types

Associated Types

type Rep PageRender :: Type -> Type #

type Rep PageRender Source # 
Instance details

Defined in Web.Page.Types

type Rep PageRender = D1 (MetaData "PageRender" "Web.Page.Types" "web-rep-0.2.0-FIwogXICtLkCMjX6u6XK6R" False) (C1 (MetaCons "Pretty" PrefixI False) (U1 :: Type -> Type) :+: (C1 (MetaCons "Minified" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "NoPost" PrefixI False) (U1 :: Type -> Type)))

type Css = StyleM () #

The Css context is used to collect style rules which are mappings from selectors to style properties. The Css type is a computation in the StyleM monad that just collects and doesn't return anything.

data PageCss Source #

unifies css as a Clay.Css and css as Text

Constructors

PageCss Css 
PageCssText Text 
Instances
Show PageCss Source # 
Instance details

Defined in Web.Page.Types

Generic PageCss Source # 
Instance details

Defined in Web.Page.Types

Associated Types

type Rep PageCss :: Type -> Type #

Methods

from :: PageCss -> Rep PageCss x #

to :: Rep PageCss x -> PageCss #

Semigroup PageCss Source # 
Instance details

Defined in Web.Page.Types

Monoid PageCss Source # 
Instance details

Defined in Web.Page.Types

type Rep PageCss Source # 
Instance details

Defined in Web.Page.Types

type Rep PageCss = D1 (MetaData "PageCss" "Web.Page.Types" "web-rep-0.2.0-FIwogXICtLkCMjX6u6XK6R" False) (C1 (MetaCons "PageCss" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Css)) :+: C1 (MetaCons "PageCssText" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text)))

renderCss :: Css -> Text Source #

render Css as text

renderPageCss :: PageRender -> PageCss -> Text Source #

render PageCss as text

newtype JS Source #

wrapper for JSAST

Constructors

JS 

Fields

Instances
Eq JS Source # 
Instance details

Defined in Web.Page.Types

Methods

(==) :: JS -> JS -> Bool #

(/=) :: JS -> JS -> Bool #

Show JS Source # 
Instance details

Defined in Web.Page.Types

Methods

showsPrec :: Int -> JS -> ShowS #

show :: JS -> String #

showList :: [JS] -> ShowS #

Generic JS Source # 
Instance details

Defined in Web.Page.Types

Associated Types

type Rep JS :: Type -> Type #

Methods

from :: JS -> Rep JS x #

to :: Rep JS x -> JS #

Semigroup JS Source # 
Instance details

Defined in Web.Page.Types

Methods

(<>) :: JS -> JS -> JS #

sconcat :: NonEmpty JS -> JS #

stimes :: Integral b => b -> JS -> JS #

Monoid JS Source # 
Instance details

Defined in Web.Page.Types

Methods

mempty :: JS #

mappend :: JS -> JS -> JS #

mconcat :: [JS] -> JS #

type Rep JS Source # 
Instance details

Defined in Web.Page.Types

type Rep JS = D1 (MetaData "JS" "Web.Page.Types" "web-rep-0.2.0-FIwogXICtLkCMjX6u6XK6R" True) (C1 (MetaCons "JS" PrefixI True) (S1 (MetaSel (Just "unJS") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 JSAST)))

data PageJs Source #

unify JSStatement javascript and text-rendered script

Constructors

PageJs JS 
PageJsText Text 
Instances
Eq PageJs Source # 
Instance details

Defined in Web.Page.Types

Methods

(==) :: PageJs -> PageJs -> Bool #

(/=) :: PageJs -> PageJs -> Bool #

Show PageJs Source # 
Instance details

Defined in Web.Page.Types

Generic PageJs Source # 
Instance details

Defined in Web.Page.Types

Associated Types

type Rep PageJs :: Type -> Type #

Methods

from :: PageJs -> Rep PageJs x #

to :: Rep PageJs x -> PageJs #

Semigroup PageJs Source # 
Instance details

Defined in Web.Page.Types

Monoid PageJs Source # 
Instance details

Defined in Web.Page.Types

type Rep PageJs Source # 
Instance details

Defined in Web.Page.Types

onLoad :: PageJs -> PageJs Source #

wrap js in standard DOM window loader

renderPageJs :: PageRender -> PageJs -> Text Source #

render PageJs as text

parseJs :: Text -> JS Source #

convert text to JS

renderJs :: JS -> Text Source #

render JS as text

data Element Source #

Abstracted message event element

Constructors

Element 

Fields

Instances
Eq Element Source # 
Instance details

Defined in Web.Page.Types

Methods

(==) :: Element -> Element -> Bool #

(/=) :: Element -> Element -> Bool #

Show Element Source # 
Instance details

Defined in Web.Page.Types

Generic Element Source # 
Instance details

Defined in Web.Page.Types

Associated Types

type Rep Element :: Type -> Type #

Methods

from :: Element -> Rep Element x #

to :: Rep Element x -> Element #

ToJSON Element Source # 
Instance details

Defined in Web.Page.Types

FromJSON Element Source # 
Instance details

Defined in Web.Page.Types

type Rep Element Source # 
Instance details

Defined in Web.Page.Types

type Rep Element = D1 (MetaData "Element" "Web.Page.Types" "web-rep-0.2.0-FIwogXICtLkCMjX6u6XK6R" False) (C1 (MetaCons "Element" PrefixI True) (S1 (MetaSel (Just "element") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text) :*: S1 (MetaSel (Just "value") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text)))

data RepF r a Source #

Constructors

Rep 

Fields

Instances
Bifunctor RepF Source # 
Instance details

Defined in Web.Page.Types

Methods

bimap :: (a -> b) -> (c -> d) -> RepF a c -> RepF b d #

first :: (a -> b) -> RepF a c -> RepF b c #

second :: (b -> c) -> RepF a b -> RepF a c #

Biapplicative RepF Source # 
Instance details

Defined in Web.Page.Types

Methods

bipure :: a -> b -> RepF a b #

(<<*>>) :: RepF (a -> b) (c -> d) -> RepF a c -> RepF b d #

biliftA2 :: (a -> b -> c) -> (d -> e -> f) -> RepF a d -> RepF b e -> RepF c f #

(*>>) :: RepF a b -> RepF c d -> RepF c d #

(<<*) :: RepF a b -> RepF c d -> RepF a b #

Functor (RepF r) Source # 
Instance details

Defined in Web.Page.Types

Methods

fmap :: (a -> b) -> RepF r a -> RepF r b #

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

Monoid r => Applicative (RepF r) Source # 
Instance details

Defined in Web.Page.Types

Methods

pure :: a -> RepF r a #

(<*>) :: RepF r (a -> b) -> RepF r a -> RepF r b #

liftA2 :: (a -> b -> c) -> RepF r a -> RepF r b -> RepF r c #

(*>) :: RepF r a -> RepF r b -> RepF r b #

(<*) :: RepF r a -> RepF r b -> RepF r a #

Semigroup r => Semigroup (RepF r a) Source # 
Instance details

Defined in Web.Page.Types

Methods

(<>) :: RepF r a -> RepF r a -> RepF r a #

sconcat :: NonEmpty (RepF r a) -> RepF r a #

stimes :: Integral b => b -> RepF r a -> RepF r a #

(Monoid a, Monoid r) => Monoid (RepF r a) Source # 
Instance details

Defined in Web.Page.Types

Methods

mempty :: RepF r a #

mappend :: RepF r a -> RepF r a -> RepF r a #

mconcat :: [RepF r a] -> RepF r a #

type Rep a = RepF (Html ()) a Source #

oneRep :: (Monad m, MonadIO m) => Rep a -> (Rep a -> HashMap Text Text -> m ()) -> StateT (HashMap Text Text) m (HashMap Text Text, Either Text a) Source #

newtype SharedRepF m r a Source #

Constructors

SharedRep 

Fields

Instances
Functor m => Bifunctor (SharedRepF m) Source # 
Instance details

Defined in Web.Page.Types

Methods

bimap :: (a -> b) -> (c -> d) -> SharedRepF m a c -> SharedRepF m b d #

first :: (a -> b) -> SharedRepF m a c -> SharedRepF m b c #

second :: (b -> c) -> SharedRepF m a b -> SharedRepF m a c #

Monad m => Biapplicative (SharedRepF m) Source # 
Instance details

Defined in Web.Page.Types

Methods

bipure :: a -> b -> SharedRepF m a b #

(<<*>>) :: SharedRepF m (a -> b) (c -> d) -> SharedRepF m a c -> SharedRepF m b d #

biliftA2 :: (a -> b -> c) -> (d -> e -> f) -> SharedRepF m a d -> SharedRepF m b e -> SharedRepF m c f #

(*>>) :: SharedRepF m a b -> SharedRepF m c d -> SharedRepF m c d #

(<<*) :: SharedRepF m a b -> SharedRepF m c d -> SharedRepF m a b #

Functor m => Functor (SharedRepF m r) Source # 
Instance details

Defined in Web.Page.Types

Methods

fmap :: (a -> b) -> SharedRepF m r a -> SharedRepF m r b #

(<$) :: a -> SharedRepF m r b -> SharedRepF m r a #

(Monad m, Monoid r) => Applicative (SharedRepF m r) Source # 
Instance details

Defined in Web.Page.Types

Methods

pure :: a -> SharedRepF m r a #

(<*>) :: SharedRepF m r (a -> b) -> SharedRepF m r a -> SharedRepF m r b #

liftA2 :: (a -> b -> c) -> SharedRepF m r a -> SharedRepF m r b -> SharedRepF m r c #

(*>) :: SharedRepF m r a -> SharedRepF m r b -> SharedRepF m r b #

(<*) :: SharedRepF m r a -> SharedRepF m r b -> SharedRepF m r a #

type SharedRep m a = SharedRepF m (Html ()) a Source #

runOnce :: Monad m => SharedRep m a -> (Html () -> HashMap Text Text -> m ()) -> m (HashMap Text Text, Either Text a) Source #

compute the initial state of a SharedRep and then run a single action (testing)

zeroState :: Monad m => SharedRep m a -> m (Html (), (HashMap Text Text, Either Text a)) Source #

compute the initial state of a SharedRep (testing)