-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Abusing monadic syntax JSON objects generation. -- -- Generation of big, complex JSON objects with Text.JSON is painful. And -- autoderivation is not always posible. Check haddock of Fields module -- for more info. @package fields-json @version 0.1 -- | Unifing some structures to JSValue module Text.JSON.ToJSON class ToJSON a toJSON :: ToJSON a => a -> JSValue instance [incoherent] ToJSON a => ToJSON (Map String a) instance [incoherent] ToJSON a => ToJSON [a] instance [incoherent] ToJSON Integer instance [incoherent] ToJSON Int instance [incoherent] ToJSON Bool instance [incoherent] ToJSON String instance [incoherent] ToJSON JSValue -- | Abusing monadic do notation library for generating JSON object. -- Hard-binded to json package from hackage. Main ideas -- --
-- json $ do -- field "a" "a" -- field "b" [1,2,3] -- field "c" $ do -- field "x" True -- field "y" False ---- -- Will generate json object {a : a, b: [1,2,3], c: {x: true, y : -- false}} module Text.JSON.Fields -- | Function for changing JSFields into real JSON object json :: JSFields -> IO JSValue -- | The JSField class instances are object that in some sence can -- be interpreted as value of JSON object fields. To derive new instances -- use existing instances since internal structure JSFields is -- hidden. class JSField a field :: JSField a => String -> a -> JSFields instance [incoherent] JSField [JSFields] instance [incoherent] JSField JSFields instance [incoherent] ToJSON a => JSField (IO a) instance [incoherent] ToJSON a => JSField a