    -- GENERATED by C->Haskell Compiler, version 0.28.6 Switcheroo, 25 November 2017 (Haskell)
    -- Edit the ORIGNAL .chs file instead!

    {-# LINE 1 "src/Codec/Compression/BZip/Foreign/Compress.chs" #-}
    module Codec.Compression.BZip.Foreign.Compress ( bZ2BzCompressInit
                                                   , bZ2BzCompress
                                                   , bZ2BzCompressEnd
                                                   , BzStreamPtr
                                                   ) where
    import qualified Foreign.C.Types as C2HSImp
    import qualified Foreign.ForeignPtr as C2HSImp
    import qualified Foreign.Ptr as C2HSImp

    import Codec.Compression.BZip.Foreign.Common
    {-# LINE 7 "src/Codec/Compression/BZip/Foreign/Compress.chs" #-}

    import Foreign.C.Types (CInt)

    type BzStreamPtr = C2HSImp.ForeignPtr (BzStream)
    {-# LINE 13 "src/Codec/Compression/BZip/Foreign/Compress.chs" #-}

    bZ2BzCompressInit :: (BzStreamPtr) -> (CInt) -> (CInt) -> (CInt) -> IO ()
    bZ2BzCompressInit :: BzStreamPtr -> CInt -> CInt -> CInt -> IO ()
    bZ2BzCompressInit a1 :: BzStreamPtr
    a1 a2 :: CInt
    a2 a3 :: CInt
    a3 a4 :: CInt
    a4 =
      BzStreamPtr -> (Ptr BzStream -> IO ()) -> IO ()
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    C2HSImp.withForeignPtr BzStreamPtr
    a1 ((Ptr BzStream -> IO ()) -> IO ())
    -> (Ptr BzStream -> IO ()) -> IO ()
    forall a b. (a -> b) -> a -> b
    $ \a1' :: Ptr BzStream
    a1' ->
      let {a2' :: CInt
    a2' = CInt -> CInt
    fromIntegral a2} in
      let {a3' = fromIntegral a3} in
      let {a4' = fromIntegral a4} in
      bZ2BzCompressInit'_ a1' a2' a3' a4' >>= \res ->
      bzWrap res >>
      return ()

    {-# LINE 15 "src/Codec/Compression/BZip/Foreign/Compress.chs" #-}

    bZ2BzCompress :: (BzStreamPtr) -> (BZAction) -> IO ((BZError))
    bZ2BzCompress a1 a2 =
      C2HSImp.withForeignPtr a1 $ \a1' ->
      let {a2' = (fromIntegral . fromEnum) a2} in
      bZ2BzCompress'_ a1' a2' >>= \res ->
      bzWrap res >>= \res' ->
      return (res')

    {-# LINE 16 "src/Codec/Compression/BZip/Foreign/Compress.chs" #-}

    foreign import ccall "Codec/Compression/BZip/Foreign/Compress.chs.h &BZ2_bzCompressEnd"
      bZ2BzCompressEnd :: C2HSImp.FinalizerPtr ()

    foreign import ccall safe "Codec/Compression/BZip/Foreign/Compress.chs.h BZ2_bzCompressInit"
      bZ2BzCompressInit'_ :: ((C2HSImp.Ptr (BzStream)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (IO C2HSImp.CInt)))))

    foreign import ccall safe "Codec/Compression/BZip/Foreign/Compress.chs.h BZ2_bzCompress"
      bZ2BzCompress'_ :: ((C2HSImp.Ptr (BzStream)) -> (C2HSImp.CInt -> (IO C2HSImp.CInt)))