Copyright | (c) Eric Mertens 2015 |
---|---|
License | ISC |
Maintainer | emertens@gmail.com |
Safe Haskell | None |
Language | Haskell2010 |
https://adventofcode.com/2015/day/12
Sum up the numbers in a JSON value.
Rather than pull in a heavy JSON parsing dependency, this just parses out the subset of JSON that the problem uses.
>>>
:main + "[1,2,3]\n"
6 6
>>>
:main + "{\"a\":2,\"b\":4}\n"
6 6
>>>
:main + "{\"a\":{\"b\":4},\"c\":-1}\n"
3 3
>>>
:main + "[1,{\"c\":\"red\",\"b\":2},3]\n"
6 4
>>>
:main + "{\"d\":\"red\",\"e\":[1,2,3,4],\"f\":5}\n"
15 0
>>>
:main + "[1,\"red\",5]\n"
6 6