servant-serialization-0.3
Safe HaskellSafe-Inferred
LanguageHaskell2010

Servant.API.ContentTypes.Binary

Synopsis

Documentation

data BinaryFmt Source #

Content-type for instances of the Binary class in the package "binary". Trailing garbage is ignored.

Instances

Instances details
Accept BinaryFmt Source #

Mime-type using the word "hackage" and the name of the package "binary".

Instance details

Defined in Servant.API.ContentTypes.Binary

Binary a => MimeRender BinaryFmt a Source #
>>> mimeRender (Proxy :: Proxy BinaryFmt) (3.14 :: Float)
"\NUL\NUL\200\245\195\255\255\255\255\255\255\255\234"
Instance details

Defined in Servant.API.ContentTypes.Binary

Binary a => MimeUnrender BinaryFmt a Source #
>>> let bsl = mimeRender (Proxy :: Proxy BinaryFmt) (3.14 :: Float)
>>> mimeUnrender (Proxy :: Proxy BinaryFmt) bsl :: Either String Float
Right 3.14
>>> mimeUnrender (Proxy :: Proxy BinaryFmt) (bsl <> "trailing garbage") :: Either String Float
Right 3.14
>>> mimeUnrender (Proxy :: Proxy BinaryFmt) ("preceding garbage" <> bsl) :: Either String Float
Left "Data.Binary.decodeOrFail: not enough bytes at byte-offset 30"
Instance details

Defined in Servant.API.ContentTypes.Binary