    -- |
    -- Module: Data.Conduit.Codec.Base32
    -- Copyright: (c) 2014 Magnus Therning
    -- License: BSD3
    module Data.Conduit.Codec.Base32 where

    import qualified Codec.Binary.Base32 as B32
    import qualified Data.Conduit.Codec.Util as U

    import Control.Monad.Catch (MonadThrow)
    import Data.ByteString (ByteString, empty)
    import Data.Conduit (ConduitT)

    encode :: (Monad m) => ConduitT ByteString ByteString m ()
    encode :: ConduitT ByteString ByteString m ()
    encode = EncFuncPart
    -> EncFuncFinal
    -> ByteString
    -> ConduitT ByteString ByteString m ()
    forall (m :: * -> *).
    Monad m =>
    EncFuncPart
    -> EncFuncFinal
    -> ByteString
    -> ConduitT ByteString ByteString m ()
    U.encodeI EncFuncPart
    B32.b32EncodePart EncFuncFinal
    B32.b32EncodeFinal ByteString
    empty

    decode :: (Monad m, MonadThrow m) => ConduitT ByteString ByteString m ()
    decode :: ConduitT ByteString ByteString m ()
    decode = DecFunc
    -> EncFuncFinal
    -> ByteString
    -> ConduitT ByteString ByteString m ()
    forall (m :: * -> *).
    (Monad m, MonadThrow m) =>
    DecFunc
    -> EncFuncFinal
    -> ByteString
    -> ConduitT ByteString ByteString m ()
    U.decodeI DecFunc
    B32.b32DecodePart EncFuncFinal
    B32.b32DecodeFinal ByteString
    empty