The sexp package

[Tags:gpl, library, program, test]

See the file and the homepage for details.

[Skip to Readme]


Versions 0.5, 0.6, 0.7
Dependencies attoparsec, base (==4.*), bytestring, cmdargs, mtl, syb [details]
License GPL-3
Author Alexandru Scvortov <>
Category Language, Parsing
Home page
Source repository head: git clone
Uploaded Tue Feb 12 18:43:53 UTC 2013 by AlexandruScvortov
Distributions NixOS:0.7
Downloads 1038 total (6 in the last 30 days)
0 []
Status Docs uploaded by user
Build status unknown [no reports yet]




Maintainer's Corner

For package maintainers and hackage trustees

Readme for sexp

Readme for sexp-0.5


S-Expression parsing/printing made fun and easy


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})