sexp: S-Expression parsing/printing made fun and easy

[ gpl, language, library, parsing, program ] [ Propose Tags ]

See the README.md file and the homepage for details.


[Skip to Readme]

Downloads

Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.5, 0.6, 0.7
Dependencies attoparsec, base (>=4 && <4.13), bytestring, cmdargs, mtl, syb [details]
License GPL-3.0-only
Author Alexandru Scvortov <scvalex@gmail.com>
Maintainer scvalex@gmail.com
Revised Revision 1 made by Bodigrim at 2024-05-15T18:53:31Z
Category Language, Parsing
Home page https://github.com/scvalex/sexp
Source repo head: git clone https://github.com/scvalex/sexp.git
Uploaded by AlexandruScvortov at 2013-02-12T18:43:53Z
Distributions
Reverse Dependencies 1 direct, 0 indirect [details]
Executables sexp
Downloads 2754 total (14 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs uploaded by user
Build status unknown [no reports yet]

Readme for sexp-0.5

[back to package description]

sexp

S-Expression parsing/printing made fun and easy

What

sexp provides an S-expression data-type, and printers and parsers that work on all data-types that have Typeable and Data instances.

λ > import Language.Sexp

λ > data MyType = Foo { unFoo :: Int } deriving ( Data, Show, Typeable )

λ > instance Sexpable MyType

λ > toSexp (Foo 23)
List [Atom "Foo",List [Atom "unFoo",Atom "23"]]

λ > printMach (toSexp (Foo 23))
"(Foo (unFoo 23))"

λ > parseExn (printMach (toSexp (Foo 23)))
[List [Atom "Foo",List [Atom "unFoo",Atom "23"]]]

λ > fromSexp (head (parseExn (printMach (toSexp (Foo 23))))) :: Maybe MyType
Just (Foo {unFoo = 23})