I’m trying to dynamically generate selectFields by mapping over mreq selectField using flip, and I’m wondering if this is the best way.
This is my attempt. After studying flip’s type I’m starting to think this may be the wrong approach. Feedback welcome.
[(versionRes,versionView)] <- mapM (mreq (flip (selectField "Placeholder" Nothing)))
versions
versions‘s type is [[(Text,Text)]].
I don’t think the errors say anything useful as, if this is possible with this approach, it’s a matter of getting the types right. I’m having difficulty doing that, and am not sure there’s a solution with this approach.
For reference here are the type definitions of mreq, flip and selectField.
Well, this is my next attempt.
[(versionRes,versionView)] <- mapM (flip mreq selectField ("Placeholder" Nothing)) versions
I’m trying to get mreq to work like this
mreq "Placeholder" Nothing (selectField [(Text),(Text)])
I have come to the conclusion that flip just isn’t practical, even if it might be possible.
I’m doing something like this instead.
versionInfo <- mapM generateVersionSelectFields [[(Text),(Text)]]generateVersionSelectFields version = domreq (selectField version) "Placeholder" Nothing
I leave this here so that maybe it gets improved or an alternative approach appears.