json-0.4.4: Support for serialising Haskell to and from JSON

Portabilityportable
Stabilityprovisional
MaintainerSigbjorn Finne <sof@galois.com>

Text.JSON.Generic

Description

JSON serializer and deserializer using Data.Generics. The functions here handle algebraic data types and primitive types. It uses the same representation as Text.JSON for Prelude types.

Synopsis

Documentation

module Text.JSON

class Typeable a => Data a

Instances

Data Bool 
Data Char 
Data Double 
Data Float 
Data Int 
Data Int8 
Data Int16 
Data Int32 
Data Int64 
Data Integer 
Data Ordering 
Data Word 
Data Word8 
Data Word16 
Data Word32 
Data Word64 
Data () 
Data TypeRep 
Data TyCon 
Data Handle 
Data ByteString 
Data ByteString 
Data DataType 
Data IntSet 
Data ThreadId 
Data a => Data [a] 
(Data a, Integral a) => Data (Ratio a) 
Typeable a => Data (StablePtr a) 
Typeable a => Data (IO a) 
Typeable a => Data (Ptr a) 
Data a => Data (Maybe a) 
Typeable a => Data (MVar a) 
Typeable a => Data (IORef a) 
Typeable a => Data (STM a) 
Typeable a => Data (ForeignPtr a) 
(Data a, Ord a) => Data (Set a) 
Data a => Data (IntMap a) 
Typeable a => Data (TVar a) 
(Data a, Data b) => Data (a -> b) 
(Data a, Data b) => Data (Either a b) 
(Data a, Data b) => Data (a, b) 
(Typeable s, Typeable a) => Data (ST s a) 
(Typeable a, Data b, Ix a) => Data (Array a b) 
(Data k, Data a, Ord k) => Data (Map k a) 
(Data a, Data b, Data c) => Data (a, b, c) 
(Data a, Data b, Data c, Data d) => Data (a, b, c, d) 
(Data a, Data b, Data c, Data d, Data e) => Data (a, b, c, d, e) 
(Data a, Data b, Data c, Data d, Data e, Data f) => Data (a, b, c, d, e, f) 
(Data a, Data b, Data c, Data d, Data e, Data f, Data g) => Data (a, b, c, d, e, f, g) 

class Typeable a

Instances

Typeable Bool 
Typeable Char 
Typeable Double 
Typeable Float 
Typeable Int 
Typeable Int8 
Typeable Int16 
Typeable Int32 
Typeable Int64 
Typeable Integer 
Typeable Ordering 
Typeable RealWorld 
Typeable Word 
Typeable Word8 
Typeable Word16 
Typeable Word32 
Typeable Word64 
Typeable () 
Typeable TypeRep 
Typeable TyCon 
Typeable JSString 
Typeable JSValue 
Typeable ByteString 
Typeable ByteString 
Typeable DataType 
Typeable IntSet 
Typeable IOException 
Typeable Deadlock 
Typeable BlockedIndefinitelyOnSTM 
Typeable BlockedIndefinitelyOnMVar 
Typeable AssertionFailed 
Typeable ExitCode 
Typeable AsyncException 
Typeable ArrayException 
(Typeable1 s, Typeable a) => Typeable (s a) 

toJSON :: Data a => a -> JSValue

Convert anything to a JSON value.

fromJSON :: Data a => JSValue -> Result a

Convert a JSON value to anything (fails if the types do not match).

encodeJSON :: Data a => a -> String

Encode a value as a string.

decodeJSON :: Data a => String -> a

Decode a string as a value.