Problems with the guide on select field

Hi, I am new to IHP and Haskell in general. I’ve been going through the IHP guide, tried different things from it on my pet project, and ran into a problem with selectField.

When I used {selectField #covenantId (Nothing:(map Just covenants))} everything worked as it should, but if I do just {selectField #covenantId covenants} I get an error

* Couldn't match type: Maybe (Id' "covenants")
                     with: Id' "covenants"
        arising from a use of `selectField'

Looks like it wants {selectField #covenantId (map Just covenants)} – presumably covenantId has type Maybe … so the value can’t be the plain covenant id, it has to be wrapped in Just

Well, I really don’t know what happened, specifically on this issue of mine, but I broke everything (for a different reason) and had to make everything from scratch and now this problem is gone :grin:

Actually, I just realize what was wrong. The covenantId column was Nullable, and that was it. There is a section in the doc about handling Maybe … in selectField, called “Select Inputs with Nullable Value”. I just didn’t read the title carefully. I need to read the doc more carefully :smile:

1 Like

Do you have any details on this? This shouldn’t really happen

Well, maybe rebuilding everything from scratch was a hasty decision (I had almost nothing to rebuild), but as I recall the problem was that the server sometimes doesn’t shut down properly, and when I restart it, it opens on other ports (8002, 8003, etc) leaving the original ports busy. Also, on my setup (windows + wsl), if you start the server with start, cli doesn’t look as nice as if you start it with devenv up. All these problems are probably due to my poor knowledge of using linux, or some other infrastructure around IHP.