Why do selectField* require Handler ?

Skip to first unread message

Simon Michael

Aug 25, 2022, 4:48:09 AMAug 25
to yeso...@googlegroups.com
Good day all!

This is a long shot, but in case anyone can advise:

I'm wondering how to add a selectFieldList here:

And I'm just curious why selectField* has to run in the Handler (HandlerFor site), unlike other field types ?


Thanks for Yesod! I have been relearning it to fix https://github.com/simonmichael/hledger/issues/1229 . The types are intense. I can see how much work they are doing and the amazing value they are providing.

I do find them pretty darn hard to untangle when you go off the beaten path..

Simon Michael

Aug 26, 2022, 3:16:08 AMAug 26
to yeso...@googlegroups.com
Long story short: I solved that type tetris (more like rubik's cube) as follows:

addModal :: Route App -> Journal -> Day -> Widget
addModal addR j today = do
(addView, addEnctype) <- handlerToWidget $ generateFormPost (addForm j today)
[whamlet| ... |]

addForm :: Journal -> Day -> Markup -> MForm Handler (FormResult Transaction, Widget)
addForm j today = identifyForm "add" $ \extra -> ...


Sep 14, 2022, 1:32:58 PMSep 14
to Yesod Web Framework
Hi Simon,

Just curious: did you find out or have an idea why selectField* have type `Field (HandlerFor site) a` and all other fields have `Field m Text` where m is just `Monad`?

- Jakob
Reply all
Reply to author
0 new messages