hyperbole-0.6.0: Interactive HTML apps using type-safe serverside Haskell
Safe HaskellSafe-Inferred
LanguageGHC2021

Web.Hyperbole.View.Types

Synopsis

Documentation

newtype View c a Source #

Views are HTML fragments with a context

helloWorld :: View context ()
helloWorld =
  el "Hello World"

Constructors

View 

Fields

Instances

Instances details
HasViewId (View ctx :: Type -> Type) (ctx :: Type) Source # 
Instance details

Defined in Web.Hyperbole.View.Types

Methods

viewId :: View ctx ctx Source #

Applicative (View ctx) Source # 
Instance details

Defined in Web.Hyperbole.View.Types

Methods

pure :: a -> View ctx a #

(<*>) :: View ctx (a -> b) -> View ctx a -> View ctx b #

liftA2 :: (a -> b -> c) -> View ctx a -> View ctx b -> View ctx c #

(*>) :: View ctx a -> View ctx b -> View ctx b #

(<*) :: View ctx a -> View ctx b -> View ctx a #

Functor (View c) Source # 
Instance details

Defined in Web.Hyperbole.View.Types

Methods

fmap :: (a -> b) -> View c a -> View c b #

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

Monad (View ctx) Source # 
Instance details

Defined in Web.Hyperbole.View.Types

Methods

(>>=) :: View ctx a -> (a -> View ctx b) -> View ctx b #

(>>) :: View ctx a -> View ctx b -> View ctx b #

return :: a -> View ctx a #

IsString (View c ()) Source # 
Instance details

Defined in Web.Hyperbole.View.Types

Methods

fromString :: String -> View c () #

Attributable (View c a) Source # 
Instance details

Defined in Web.Hyperbole.View.Types

Methods

(@) :: View c a -> (Attributes (View c a) -> Attributes (View c a)) -> View c a #

modAttributes :: (Map Name AttValue -> Map Name AttValue) -> View c a -> View c a #

Styleable (View c a) Source # 
Instance details

Defined in Web.Hyperbole.View.Types

Methods

(~) :: View c a -> (CSS (View c a) -> CSS (View c a)) -> View c a #

modCSS :: ([Rule] -> [Rule]) -> View c a -> View c a #

Styleable (TableColumns c dt () -> View c ()) Source # 
Instance details

Defined in Web.Hyperbole.View.Tag

Methods

(~) :: (TableColumns c dt () -> View c ()) -> (CSS (TableColumns c dt () -> View c ()) -> CSS (TableColumns c dt () -> View c ())) -> TableColumns c dt () -> View c () #

modCSS :: ([Rule] -> [Rule]) -> (TableColumns c dt () -> View c ()) -> TableColumns c dt () -> View c () #

execView :: forall c a. c -> ViewState c -> View c a -> Html a Source #

newtype ChildView a Source #

Constructors

ChildView a 

Instances

Instances details
Generic (ChildView a) Source # 
Instance details

Defined in Web.Hyperbole.View.Types

Associated Types

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

Methods

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

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

(ViewId a, FromParam a, ToParam a) => ViewId (ChildView a) Source # 
Instance details

Defined in Web.Hyperbole.View.Types

Associated Types

type ViewState (ChildView a) Source #

type Rep (ChildView a) Source # 
Instance details

Defined in Web.Hyperbole.View.Types

type Rep (ChildView a) = D1 ('MetaData "ChildView" "Web.Hyperbole.View.Types" "hyperbole-0.6.0-inplace" 'True) (C1 ('MetaCons "ChildView" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)))
type ViewState (ChildView a) Source # 
Instance details

Defined in Web.Hyperbole.View.Types

context :: forall c. View c (c, ViewState c) Source #

runViewContext :: ctx -> ViewState ctx -> View ctx () -> View c () Source #

runChildView :: ViewState ctx ~ ViewState c => (c -> ctx) -> View ctx () -> View c () Source #

class HasViewId m view where Source #

Access the viewId in a View or update

data LazyData = LazyData TaskId
  deriving (Generic, ViewId)

instance (Debug :> es, GenRandom :> es) => HyperView LazyData es where
  data Action LazyData
    = Details
    deriving (Generic, ViewAction)

  update Details = do
    LazyData taskId <- viewId
    task <- pretendLoadTask taskId
    pure $ viewTaskDetails task

Methods

viewId :: m view Source #

Instances

Instances details
ViewState view ~ st => HasViewId (Eff (Reader view ': (State st ': es)) :: Type -> Type) (view :: Type) Source # 
Instance details

Defined in Web.Hyperbole.View.Types

Methods

viewId :: Eff (Reader view ': (State st ': es)) view Source #

HasViewId (View ctx :: Type -> Type) (ctx :: Type) Source # 
Instance details

Defined in Web.Hyperbole.View.Types

Methods

viewId :: View ctx ctx Source #