Closed GildedHonour closed 4 years ago
Why doesn't it work with HttpMethod
?
• Could not deduce: HttpBodyAllowed (AllowsBody me) 'NoBody
arising from a use of ‘req’
from the context: HttpMethod me
bound by the type signature for:
send12 :: forall me.
HttpMethod me => [..........]
Then add HttpBodyAllowed (AllowsBody me) 'NoBody
as a constraint to your function.
Thanks.
I have these functions which are identiacal except that one sends a GET request, the other POST one.
I want to pass
GET
andPOST
as a parameter and thus merge the functions into a single one. I haven't found a way.Later on I might want to add PUT and DELETE too. For now I need only GET and POST
GET
andPOST
are both distinct data types in the library.The
HttpMethod
class won't help either - it won't compile:I don't want to create yet another new data type -
MyHttpMethod
, as a workaround, that'll have 2 constructors -GET
andPOST
. I don't want to introduce new types.Then how else?