-- Quasi quotes in curly brackets {-# LANGUAGE ViewPatterns #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TemplateHaskell, QuasiQuotes #-} -- import libraries import Yesod import Data.Text import Control.Applicative import Yesod.Form - set the web server port Warp to 3000 main :: IO () main = warp 3000 FormApp data FormApp = FormApp instance Yesod FormApp instance RenderMessage FormApp FormMessage where renderMessage _ _ = defaultFormMessage - the "FormApp" web application only provides one route mkYesod "FormApp" [parseRoutes| /contact ContactR GET |] - an auxiliary function integrates the form widget into a web page page enctype widget res = defaultLayout $ do -- set the title of the website setTitle "Contact" [whamlet|

Result: #{show res}

^{widget}