content: {-# LANGUAGE CPP #-}
  {-# LANGUAGE RankNTypes #-}
  
  -- |
  -- Module      : Data.Binary.Serialise.CBOR.Read
  -- Copyright   : (c) Duncan Coutts 2015-2017
  -- License     : BSD3-style (see LICENSE.txt)
  --
  -- Maintainer  : duncan@community.haskell.org
  -- Stability   : experimental
  -- Portability : non-portable (GHC extensions)
  --
  -- Tools for reading values in a CBOR-encoded format
  -- back into ordinary values.
  --
  module Data.Binary.Serialise.CBOR.Read
   ( module X
   , deserialiseFromBytes
   ) where
  
  import           Codec.CBOR.Read as X hiding (deserialiseFromBytes)
  import qualified Codec.CBOR.Read as Read
  import           Codec.CBOR.Decoding (Decoder)
  import qualified Data.ByteString.Lazy as LBS
  
  -- To avoid -Wunused-packages warnings.
  -- We only re-export its interface, but not using it in any module of
  -- binary-serialise-cbor
  #ifdef MIN_VERSION_serialise
  import Codec.Serialise ()
  #endif
  
  deserialiseFromBytes :: (forall s. Decoder s a)
                       -> LBS.ByteString
                       -> Either Read.DeserialiseFailure a
  deserialiseFromBytes f = fmap snd . Read.deserialiseFromBytes f
  