mirror of
https://github.com/NorfairKing/autodocodec.git
synced 2024-11-26 08:01:33 +03:00
Yaml encoding via Yaml.toByteString instead of Yaml.encode
This commit is contained in:
parent
b49e3f4201
commit
cbfdf3bd52
@ -35,10 +35,11 @@ import Autodocodec.Yaml.IO
|
|||||||
import Autodocodec.Yaml.Schema
|
import Autodocodec.Yaml.Schema
|
||||||
import Data.ByteString
|
import Data.ByteString
|
||||||
import qualified Data.Yaml as Yaml
|
import qualified Data.Yaml as Yaml
|
||||||
|
import qualified Data.Yaml.Builder as Yaml
|
||||||
|
|
||||||
-- | Encode a value as a Yaml 'ByteString' via its type's 'codec'.
|
-- | Encode a value as a Yaml 'ByteString' via its type's 'codec'.
|
||||||
encodeYamlViaCodec :: HasCodec a => a -> ByteString
|
encodeYamlViaCodec :: HasCodec a => a -> ByteString
|
||||||
encodeYamlViaCodec = Yaml.encode . Autodocodec
|
encodeYamlViaCodec = Yaml.toByteString . Autodocodec
|
||||||
|
|
||||||
-- | Parse a Yaml 'ByteString' using a type's 'codec'.
|
-- | Parse a Yaml 'ByteString' using a type's 'codec'.
|
||||||
eitherDecodeYamlViaCodec :: HasCodec a => ByteString -> Either Yaml.ParseException a
|
eitherDecodeYamlViaCodec :: HasCodec a => ByteString -> Either Yaml.ParseException a
|
||||||
|
Loading…
Reference in New Issue
Block a user