File tree Expand file tree Collapse file tree 3 files changed +6
-5
lines changed
Expand file tree Collapse file tree 3 files changed +6
-5
lines changed Original file line number Diff line number Diff line change 1313 "dependencies" : {
1414 "purescript-console" : " ^0.1.0" ,
1515 "purescript-foreign" : " ~0.7.0" ,
16- "purescript-generics" : " ~0.4 .0"
16+ "purescript-generics" : " ^0.5 .0"
1717 }
1818}
Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ readGeneric = map (fromJust <<< fromSpine) <<< go (toSignature (anyProxy :: Prox
2626 go SigNumber f = map SNumber (readNumber f)
2727 go SigInt f = map SInt (readInt f)
2828 go SigString f = map SString (readString f)
29+ go SigBoolean f = map SBoolean (readBoolean f)
2930 go (SigArray el) f = do arr <- readArray f
3031 els <- for arr \f -> do
3132 e <- go (el unit) f
@@ -46,4 +47,4 @@ readGeneric = map (fromJust <<< fromSpine) <<< go (toSignature (anyProxy :: Prox
4647
4748-- | Read a value which has a `Generic` type from a JSON String
4849readJSONGeneric :: forall a . (Generic a ) => String -> F a
49- readJSONGeneric = parseJSON >=> readGeneric
50+ readJSONGeneric = parseJSON >=> readGeneric
Original file line number Diff line number Diff line change @@ -21,13 +21,13 @@ json = """
2121 {
2222 "tag": "Leaf",
2323 "values": [
24- 1
24+ true
2525 ]
2626 },
2727 {
2828 "tag": "Leaf",
2929 "values": [
30- 2
30+ false
3131 ]
3232 }
3333 ]
@@ -39,6 +39,6 @@ readTree :: forall a. (Generic a) => String -> F (Tree a)
3939readTree = readJSONGeneric
4040
4141main = do
42- case readTree json :: F (Tree Int ) of
42+ case readTree json :: F (Tree Boolean ) of
4343 Right tree -> log (gShow tree)
4444 Left err -> print err
You can’t perform that action at this time.
0 commit comments