Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions Data/Aeson.hs
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,30 @@ module Data.Aeson
, FromJSON(..)
, Result(..)
, fromJSON
, FromJSON1(..)
, parseJSON1
, FromJSON2(..)
, parseJSON2
, ToJSON(..)
, ToJSON1(..)
, toJSON1
, toEncoding1
, ToJSON2(..)
, toJSON2
, toEncoding2
, KeyValue(..)
-- ** Generic JSON classes and options
, GFromJSON(..)
, GToJSON(..)
, GToEncoding(..)
, Zero
, One
, genericToJSON
, genericLiftToJSON
, genericToEncoding
, genericLiftToEncoding
, genericParseJSON
, genericLiftParseJSON
, defaultOptions

-- * Inspecting @'Value's@
Expand Down
7 changes: 6 additions & 1 deletion Data/Aeson/Encode/Functions.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ module Data.Aeson.Encode.Functions
(
brackets
, builder
, builderWith
, char7
, encode
, foldable
Expand All @@ -26,9 +27,13 @@ import Data.Monoid (mempty)
#endif

builder :: ToJSON a => a -> Builder
builder = fromEncoding . toEncoding
builder = builderWith toEncoding
{-# INLINE builder #-}

builderWith :: (a -> Encoding) -> a -> Builder
builderWith te = fromEncoding . te
{-# INLINE builderWith #-}

-- | Efficiently serialize a JSON value as a lazy 'L.ByteString'.
--
-- This is implemented in terms of the 'ToJSON' class's 'toEncoding' method.
Expand Down
Loading