Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Data.Ron.Serialize
Contents
Description
Definitions for serializing values into bytes. When serializing, you must
choose a formatting option defined at SerializeSettings
Synopsis
- encode :: ToRon a => SerializeSettings -> a -> ByteString
- encodeFile :: ToRon a => SerializeSettings -> FilePath -> a -> IO ()
- dumps :: SerializeSettings -> Value -> ByteString
- dumpFile :: SerializeSettings -> FilePath -> Value -> IO ()
- data SerializeSettings = SerializeSettings {}
- haskellStyle :: SerializeSettings
- rustStyle :: SerializeSettings
- compactStyle :: SerializeSettings
- data CommaStyle
- ronBuilder :: SerializeSettings -> Value -> Builder
Documentation
encode :: ToRon a => SerializeSettings -> a -> ByteString Source #
Serialize a value to a lazy bytestring. For settings you can use
haskellStyle
or rustStyle
or compactStyle
encodeFile :: ToRon a => SerializeSettings -> FilePath -> a -> IO () Source #
Serialize a value into a file. For settings you can use
haskellStyle
or rustStyle
or compactStyle
dumps :: SerializeSettings -> Value -> ByteString Source #
Serialize a RON value to a lazy bytestring. You probably want to use
encode
instead
dumpFile :: SerializeSettings -> FilePath -> Value -> IO () Source #
Serialize a RON value into a file. You probably want to use encodeFile
instead
Style options
data SerializeSettings Source #
Constructors
SerializeSettings | |
Fields
|
Instances
Arbitrary SerializeSettings Source # | |
Defined in Data.Ron.Serialize | |
Show SerializeSettings Source # | |
Defined in Data.Ron.Serialize Methods showsPrec :: Int -> SerializeSettings -> ShowS # show :: SerializeSettings -> String # showList :: [SerializeSettings] -> ShowS # | |
Eq SerializeSettings Source # | |
Defined in Data.Ron.Serialize Methods (==) :: SerializeSettings -> SerializeSettings -> Bool # (/=) :: SerializeSettings -> SerializeSettings -> Bool # |
haskellStyle :: SerializeSettings Source #
Style similar to what is produced in haskell with stylish-haskell or hindent.
- Uses indent size of 4
- Unpacks top level values
rustStyle :: SerializeSettings Source #
Style similar to what is produced by rustfmt, or by ron-rs itself
compactStyle :: SerializeSettings Source #
All whitespace is disabled. Does not unpack toplevel for compatability, so you can set that if you want an even compacter style that can't be read by ron-rs
data CommaStyle Source #
Style of comma in compound values
Constructors
CommaHistoric | Like in json, comma after value without trailing |
CommaTrailing | Comma after value, including last element |
CommaLeading | Haskell style, comma at line start |
Instances
Arbitrary CommaStyle Source # | |
Defined in Data.Ron.Serialize | |
Bounded CommaStyle Source # | |
Defined in Data.Ron.Serialize | |
Enum CommaStyle Source # | |
Defined in Data.Ron.Serialize Methods succ :: CommaStyle -> CommaStyle # pred :: CommaStyle -> CommaStyle # toEnum :: Int -> CommaStyle # fromEnum :: CommaStyle -> Int # enumFrom :: CommaStyle -> [CommaStyle] # enumFromThen :: CommaStyle -> CommaStyle -> [CommaStyle] # enumFromTo :: CommaStyle -> CommaStyle -> [CommaStyle] # enumFromThenTo :: CommaStyle -> CommaStyle -> CommaStyle -> [CommaStyle] # | |
Show CommaStyle Source # | |
Defined in Data.Ron.Serialize Methods showsPrec :: Int -> CommaStyle -> ShowS # show :: CommaStyle -> String # showList :: [CommaStyle] -> ShowS # | |
Eq CommaStyle Source # | |
Defined in Data.Ron.Serialize |
Low-level builders
ronBuilder :: SerializeSettings -> Value -> Builder Source #
The builder producing the serialized representation. You can use this to write ron to outputs not supported by this library, like pipes or conduits