Add a FromParam instance for String.#16
Conversation
| fromParam [x] = Right x | ||
| fromParam [] = Left ParamMissing | ||
| fromParam _ = Left ParamTooMany | ||
| instance {-# INCOHERENT #-} FromParam String where |
There was a problem hiding this comment.
Can you tell me a little more about why "INCOHERENT" is needed here? I've never seen it before.
There was a problem hiding this comment.
Hi. The reason is that String is actually [Char] and so GHC complains that it is overlapped with the FromParam [a] instance below. (According to the doc, GHC will not take context (i.e. constrains before =>) into account when matching instances.)
One solution is to add "INCOHERENT" pragma according to this. I am not sure if there is a better solution.
There was a problem hiding this comment.
That makes sense. Let me think a little about whether this feature is worth that extra bit of type complexity. Regardless I appreciate you taking the time to make this PR
There was a problem hiding this comment.
No problem. Thank you very much!
Fixes #15.