Hello, when the somePage does not contain any arguments, it builds. But when I try to customize this page and use a User argument, it fails on h2_ line. Why? It seems to be a so trivial thing - to print a custom text, but it fails.
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ExtendedDefaultRules #-}
import Lucid
data User = User
{ name :: Text
, email :: Text
} deriving (Eq, Show, Generic)
somePage :: User -> Html ()
somePage (User name email) = html_ $ do
head_ $ do
title_ "Some Page"
body_ $ do
h2_ "This single line builds"
h2_ ("But this line does not build" ++ unpack username)
The build error is:
Couldn't match type: HtmlT Data.Functor.Identity.Identity a0
with: [Char]
arising from a functional dependency between:
constraint ‘Term [Char] (HtmlT Data.Functor.Identity.Identity a0)’
arising from a use of ‘h2_’
instance ‘Term (HtmlT m a) (HtmlT m a)’ at <no location info>