Skip to content

Failure to parse Array of Tuples of Tuples #23

@z0isch

Description

@z0isch

I think I have found a bug in encoding/decoding things of this shape:

Array (Tuple (Tuple Int Int) Int)

Running this program:

type A = Array (Tuple (Tuple Int Int) Int)
a = [Tuple (Tuple 1 2) 3]
main = log $ stringify $ encodeJson a

returns the string [[1,2,3]] which I believe should be [[[1,2],3]]

There seems to also be an error when decoding:

type A = Array (Tuple (Tuple String Unit) Unit)
a = "[[[1,2],3]]"
main = logShow $ (jsonParser (stringify $ encodeJson a) >>= decodeJson) :: Either String A

which gives (Left "Generic json decoding failed: Expected an array: '\"[[[1,2],3]]\"'")

I'm trying to decode values from Haskell that look like [((Int,Int), Int)] but maybe Array (Tuple (Tuple Int Int) Int) isn't the correct PureScript representation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions