I would like to make some html fragments with the lucid html dsl. These would simplify bootstraps row and cols
what I have now looks like this
row_ :: Html () -> Html ()
row_ content = do
div_ [class_ "row"] $ do
content
col_lg_3_ :: Html () -> Html ()
col_lg_3_ content = do
div_ [class_ "col-lg-3"] $ do
content
data HomeView = HomeView
instance ToHtml HomeView where
toHtml HomeView = do
h1_ "Home Page"
row_ $ do
col_lg_3_ $ do
p_ "This is content"
toHtmlRaw = toHtml
However, I get the type error
• Couldn't match type ‘m’ with ‘Data.Functor.Identity.Identity’
‘m’ is a rigid type variable bound by
the type signature for:
toHtml :: forall (m :: * -> *). Monad m => HomeView -> HtmlT m ()
at src/Lib.hs:36:3-8
Expected type: HtmlT m ()
Actual type: Html ()
• In a stmt of a 'do' block:
row_ $ do col_lg_3_ $ do p_ "This is content"
In the expression:
do h1_ "Home Page"
row_ $ do col_lg_3_ $ do ...
In an equation for ‘toHtml’:
toHtml HomeView
= do h1_ "Home Page"
row_ $ do col_lg_3_ $ ...
• Relevant bindings include
toHtml :: HomeView -> HtmlT m () (bound at src/Lib.hs:36:3)
|
38 | row_ $ do
| ^^^^^^^^^...
I don’t really understand what to do next.