-
Notifications
You must be signed in to change notification settings - Fork 0
/
IDHtmlT.purs
57 lines (42 loc) · 1.5 KB
/
IDHtmlT.purs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
module InteractiveData.Core.Types.IDHtmlT
( IDHtmlT(..)
, runIDHtmlT
) where
import Prelude
import Chameleon (class Html, class MapMaybe)
import Chameleon.Styled (class HtmlStyled, StyleT, runStyleT)
import Chameleon.Transformers.Ctx.Class (class AskCtx, class Ctx)
import Chameleon.Transformers.Ctx.Trans (CtxT, runCtxT)
import Chameleon.Transformers.OutMsg.Class (class OutMsg, class RunOutMsg)
import Chameleon.Transformers.OutMsg.Trans (OutMsgT, runOutMsgT)
import InteractiveData.Core (class IDHtml, IDOutMsg, IDViewCtx)
newtype IDHtmlT html a = IDHtmlT
( CtxT IDViewCtx
( StyleT
(OutMsgT IDOutMsg html)
)
a
)
derive newtype instance Html html => Html (IDHtmlT html)
derive newtype instance Html html => MapMaybe (IDHtmlT html)
derive newtype instance AskCtx IDViewCtx (IDHtmlT html)
derive newtype instance Ctx IDViewCtx (IDHtmlT html)
derive newtype instance Html html => OutMsg IDOutMsg (IDHtmlT html)
derive newtype instance Html html => RunOutMsg IDOutMsg (IDHtmlT html)
derive instance Functor html => Functor (IDHtmlT html)
derive newtype instance Html html => HtmlStyled (IDHtmlT html)
instance Html html => IDHtml (IDHtmlT html)
runIDHtmlT
:: forall html msg
. Html html
=> IDViewCtx
-> IDHtmlT html msg
-> html msg
runIDHtmlT viewCtx (IDHtmlT idHtml) =
let
styleHtml :: StyleT (OutMsgT IDOutMsg html) msg
styleHtml = runCtxT idHtml viewCtx
outMsgHtml :: OutMsgT IDOutMsg html msg
outMsgHtml = runStyleT styleHtml
in
runOutMsgT outMsgHtml