How to deal with HTML input select option on a form using in a scotty and Text.Blaze.Html5

I am using scotty and Text.Blaze.Html5 Text.Digestive Text.Digestive.Blaze.Html5 What I want to achieve is a list of options as shown below. I have a Option sum type and will like to restrict the user to those options. data Options = Option1 | Option2 | Option3 | Option4 deriving Show Below is the Register record typeY data Register = Register { regName::Text , regOption::Options } deriving (Show,Eq) My problem is with Text.Digestive.choice. I don't know how to use it with Text.Digestive.Blaze.Html5 and will appreciate your help on the correct way to achieve this. I have tried to use the code below but battle to get it right. registerForm :: Monad m => Form Text m Register registerForm = Register <$> "name" .: text Nothing <*> "options" .: choice options Nothing where options= [(Option1,"Option1"),(Option2,"Option2"), (Option3, "Option3"),Option4,"Option4"] registerView:: View H.Html -> H.Html registerView view = do label "name" view "Name: " inputText "name" view H.br label "options" view "Options: " inputSelect "options" view H.br I get the following error when I compile my code: /root/work/src/Adapter/HTTP/Web/Auth.hs:107:29: error: • Couldn't match type ‘Text’ with ‘Char’ arising from the literal ‘"Option1"’ • In the first argument of ‘pack’, namely ‘"Option1"’ In the expression: pack "Option1" In the expression: (Option1, pack "Option1") | 107 | options= [(Option1,pack "Option1"),(Option2,pack "Option2"),(Option3,pack "Option3"),(Option4,pack "Option4")] Your help will be highly appreciated.
participants (1)
-
Tebogo Sikwane