You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As described in the fregedoc, parseJSON fails if it is decoding a string neither into an object nor an array:
import frege.data.JSON
main = println $ (parseJSON "true"::MaybeBool)
-- prints "Nothing"
However, since Bool is an instance of FromJSON it's misleading.
It's true that any valid JSON should have an object or an array as its top-level entity. However, I think it's applications' responsibility to check the validity of a JSON, and the implementation of the library should be consistent to its type.
The text was updated successfully, but these errors were encountered:
On 6 Aug 2018, at 0:26, matil019 wrote:
It's true that any valid JSON should have an object or an array as its top-level entity. However, I think it's applications' responsibility to check the validity of a JSON, and the implementation of the library should be consistent to its type.
Actually, `true` IS valid JSON. As is `"Hello World"`, even `42` is valid JSON.
Or more, they are valid representations of JSON Values.
As described in the fregedoc,
parseJSON
fails if it is decoding a string neither into an object nor an array:However, since
Bool
is an instance ofFromJSON
it's misleading.It's true that any valid JSON should have an object or an array as its top-level entity. However, I think it's applications' responsibility to check the validity of a JSON, and the implementation of the library should be consistent to its type.
The text was updated successfully, but these errors were encountered: