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

Web.Hyperbole.HyperView.Handled

Synopsis

Documentation

hyper :: forall id ctx. (HyperViewHandled id ctx, ViewId id) => id -> View id () -> View ctx () Source #

Embed a HyperView into a page or another View

page :: Page es '[Message]
page = do
  pure $ do
    el "Unchanging Header"
    hyper Message $ messageView "Hello World"

hyperUnsafe :: ViewId id => id -> View id () -> View ctx () Source #

type family ValidDescendents x :: [Type] where ... Source #

Equations

ValidDescendents x = x : NextDescendents '[] '[x] 

type family NextDescendents (ex :: [Type]) (xs :: [Type]) where ... Source #

Equations

NextDescendents _ '[] = '[] 
NextDescendents ex (x ': xs) = (RemoveAll (x : ex) (Require x) <++> NextDescendents ((x : ex) <++> Require x) (RemoveAll (x : ex) (Require x))) <++> NextDescendents (x : ex) (RemoveAll (x : ex) xs) 

type NotHandled id ctx (views :: [Type]) = TypeError ((((((((('Text "HyperView " :<>: 'ShowType id) :<>: 'Text " not found in (Require ") :<>: 'ShowType ctx) :<>: 'Text ")") :$$: ('Text " " :<>: 'ShowType views)) :$$: 'Text "Try adding it to the HyperView instance:") :$$: (('Text " instance HyperView " :<>: 'ShowType ctx) :<>: 'Text " where")) :$$: (((('Text " type Action " :<>: 'ShowType ctx) :<>: 'Text " = ") :<>: ShowType (Action id)) :<>: 'Text "")) :$$: (((('Text " type Require " :<>: 'ShowType ctx) :<>: 'Text " = [") :<>: ShowType id) :<>: 'Text ", ...]")) Source #

type NotDesc id ctx x cs = TypeError (((((('Text "" :<>: 'ShowType x) :<>: 'Text ", a child of HyperView ") :<>: 'ShowType id) :<>: 'Text ", not handled by context ") :<>: 'ShowType ctx) :$$: ('Text " Require = " ':<>: 'ShowType cs)) Source #

type NotInPage x total = TypeError ((((('Text "" :<>: 'ShowType x) :<>: 'Text " not included in: ") :$$: ('Text " Page es " :<>: ShowType total)) :$$: 'Text "try expanding the page views to:") :$$: ('Text " Page es " :<>: ShowType (x : total))) Source #

type HyperViewHandled id ctx = (ElemOr id (ctx : Require ctx) (NotHandled id ctx (Require ctx)), CheckDescendents id ctx) Source #

type family CheckDescendents id ctx :: Constraint where ... Source #

Equations

CheckDescendents id (Root total) = AllInPage (ValidDescendents id) total 
CheckDescendents id ctx = () 

type family AllInPage ids total :: Constraint where ... Source #

Equations

AllInPage '[] _ = () 
AllInPage (x ': xs) total = (ElemOr x total (NotInPage x total), AllInPage xs total)