Another error section 4 subsection "other uses of checkRq" in the code RqDataCheckOther.hs
you're gonna get an error on compilation that reads:
Ambiguous type variable `a0' in the constraints:
(Num a0) arising from the literal `1' at rqDataCheckOther.hs:17:56
(Ord a0)
arising from a use of `inRange' at rqDataCheckOther.hs:17:48-54
(Show a0)
arising from a use of `inRange' at rqDataCheckOther.hs:17:48-54
(Happstack.Server.Internal.Types.FromReqURI a0)
arising from a use of `lookRead' at rqDataCheckOther.hs:17:24-31
Probable fix: add a type signature that fixes these type variable(s)
In the first argument of `inRange', namely `1'
In the second argument of `checkRq', namely `(inRange 1 10)'
In the first argument of `getDataFn', namely
`(lookRead "i" `checkRq` (inRange 1 10))'
that's because we're giving it any type instance of 1 and 10 to
Ord so it doesn't know what it is, it can be any type with a
Num instance
so as advised in section 3 subsection 4 sub-subsection 3 "Ambiguous Types" we need an explicit type.
Revised function should read:
oneToTenPart :: ServerPart String
oneToTenPart =
do r <- getDataFn (lookRead "i" `checkRq` (inRange
(1::Int) (10::Int))) case r of
(Left e) ->
badRequest $ unlines e
(Right i) ->
ok $ "You picked: " ++ show i
where the bolded parts are the changes.
also idk if there's an
actual thread where to post these kinds of errors, please say so if there is...