parse example in documentation doesn't compile
Closed this issue · 3 comments
tombusby commented
Similar issue as last time:
let Result val iss = parse unjsonExample (Anchored mempty $ object [ "name" .= 123, "array_of_ints" .= [toJSON 123, toJSON "abc"], "optional_bool" .= True ])
This produces a type error:
<interactive>:24:47: error:
• Couldn't match expected type ‘Value’
with actual type ‘Anchored Value’
• In the second argument of ‘parse’, namely
‘(Anchored mempty
$ object
["name" .= 123, "array_of_ints" .= [toJSON 123, toJSON "abc"],
"optional_bool" .= True])’
In the expression:
parse
unjsonExample
(Anchored mempty
$ object
["name" .= 123, "array_of_ints" .= [toJSON 123, toJSON "abc"],
"optional_bool" .= True])
In a pattern binding:
Result val iss
= parse
unjsonExample
(Anchored mempty
$ object
["name" .= 123, "array_of_ints" .= [toJSON 123, ....],
"optional_bool" .= True])
Getting rid of the Anchored mempty $
stuff allows it to compile properly:
let Result val iss = parse unjsonExample $ object [ "name" .= 123, "array_of_ints" .= [toJSON 123, toJSON "abc"], "optional_bool" .= True ]
tombusby commented
Cool, I'll submit a PR.
23Skidoo commented
Beat you to it :-)