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

Safe HaskellNone

Data.Sexp

Contents

Description

S-Expressions are represented by Sexp. Conversions of arbitrary types to and from Sexp are done via the Sexpable type class.

The default implementation of Sexpable's toSexp and fromSexp require the type to have a Data instance. In other words, if a type is representable (which most types are), it is also Sexpable.

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

instance Sexpable MyType

Synopsis

S-Expressions

data Sexp Source

A ByteString-based S-Expression. Conceptually, a Sexp is either an single atom represented by a ByteString, or a list of Sexp.

Constructors

List [Sexp] 
Atom ByteString 

Instances

class Sexpable a whereSource

Type class for things that can be converted to and from S-Expressions.

Methods

toSexp :: a -> SexpSource

fromSexp :: (Monad m, Applicative m) => Sexp -> m aSource

Helpers