on master help sign in
Added unsafeToEncoding
commit10c7dc582c44177a6d91119ca6bb483dbfca48ba authorRobert Klotzner <robert.klotzner@gmx.at> dateMon 11 Apr 2016, 10:32 (11 years ago) parent88dd775
2 files changed+9
Data/Aeson/Types.hs+1 Data/Aeson/Types/Internal.hs+8
Data/Aeson/Types.hs+1
@@ -14,6 +14,7 @@ module Data.Aeson.Types
1414 -- * Core JSON types
1515 Value(..)
1616 , Encoding
17+ , unsafeToEncoding
1718 , fromEncoding
1819 , Series
1920 , Array
Data/Aeson/Types/Internal.hs+8
@@ -25,6 +25,7 @@ module Data.Aeson.Types.Internal
2525 -- * Core JSON types
2626 Value(..)
2727 , Encoding(..)
28+ , unsafeToEncoding
2829 , Series(..)
2930 , Array
3031 , emptyArray, isEmptyArray
@@ -343,6 +344,13 @@ newtype Encoding = Encoding {
343344 -- ^ Acquire the underlying bytestring builder.
344345 } deriving (Semigroup,Monoid)
345346
347+-- | Make Encoding from Builder.
348+--
349+-- Use with care! You have to make sure that the passed Builder
350+-- is a valid JSON Encoding!
351+unsafeToEncoding :: Builder -> Encoding
352+unsafeToEncoding = Encoding
353+
346354instance Show Encoding where
347355 show (Encoding e) = show (toLazyByteString e)
348356