module Blaze.ByteString.Builder.Compat.Write
( Write
, writePrimFixed
, writePrimBounded
) where
import Data.ByteString.Builder.Prim.Internal (BoundedPrim, FixedPrim
, runB, runF, size, sizeBound)
import Blaze.ByteString.Builder.Internal.Write (Poke(..), Write
, boundedWrite, exactWrite)
writePrimFixed :: FixedPrim a -> a -> Write
writePrimFixed fe a = exactWrite (size fe) (runF fe a)
{-# INLINE writePrimFixed #-}
writePrimBounded :: BoundedPrim a -> a -> Write
writePrimBounded be a = boundedWrite (sizeBound be) (Poke (runB be a))
{-# INLINE writePrimBounded #-}