gdritter repos s-cargot / f91285f
Minor wording changes to repr section Getty Ritter 9 years ago
1 changed file(s) with 11 addition(s) and 15 deletion(s). Collapse all Expand all
5555 | WFSAtom atom
5656 ~~~~
5757
58 In the above, an `RSList [a, b, c]` and a
59 `WFList [a, b, c]` both correspond to the structure
60 `SCons a (SCons b (SCons d SNil))`, which corresponds to an
61 S-expression which can be written as
62 `(a b c)` or as `(a . (b . (c . ())))`. A `RSDotList`
63 corresponds to an sequence of conses that does not terminate
64 in an empty list, e.g. `RSDotList [a, b] c` corresponds to
65 `SCons a (SCons b (SAtom c))`, which in turn corresponds to
66 a structure like `(a b . c)` or `(a . (b . c))`.
58 The `WellFormedSExpr` representation should be structurally
59 identical to the `RichSExpr` representation in all cases where
60 no improper lists appear in the source. Both of those are
61 often more convenient than writing multiple nested `SCons`
62 constructors in Haskell.
6763
6864 Functions for converting back and forth between
6965 representations are provided, but you can also modify a
7268 functions.
7369
7470 ~~~~
75 *Data.SCargot.General> decode spec "(a b c)"
76 Right [SCons (SAtom "a") (SCons (SAtom "b") (SCons (SAtom "c") SNil))]
77 *Data.SCargot.General> decode (asRich spec) "(a b c)"
78 Right [RSList [RSAtom "a",RSAtom "b",RSAtom "c"]]
79 *Data.SCargot.General> decode (asWellFormed spec) "(a b c)"
80 Right [WFSList [WFSAtom "a",WFSAtom "b",WFSAtom "c"]]
71 *Data.SCargot.General> decode spec "(a b)"
72 Right [SCons (SAtom "a") (SCons (SAtom "b") SNil)]
73 *Data.SCargot.General> decode (asRich spec) "(a b)"
74 Right [RSList [RSAtom "a",RSAtom "b"]]
75 *Data.SCargot.General> decode (asWellFormed spec) "(a b)"
76 Right [WFSList [WFSAtom "a",WFSAtom "b"]]
8177 *Data.SCargot.General> decode spec "(a . b)"
8278 Right [SCons (SAtom "a") (SAtom "b")]
8379 *Data.SCargot.General> decode (asRich spec) "(a . b)"