    -- ASCIIArmor/Utils.hs: OpenPGP (RFC4880) ASCII armor implementation
    -- Copyright © 2012  Clint Adams
    -- This software is released under the terms of the Expat license.
    -- (See the LICENSE file).

    module Codec.Encryption.OpenPGP.ASCIIArmor.Utils (
       crlfUnlines
     , crlfUnlinesLazy
    ) where

    import Data.ByteString (ByteString)
    import qualified Data.ByteString as B
    import qualified Data.ByteString.Char8 as BC8
    import qualified Data.ByteString.Lazy as BL
    import qualified Data.ByteString.Lazy.Char8 as BLC8
    import Data.List (intersperse)

    crlfUnlines :: [ByteString] -> ByteString
    crlfUnlines :: [ByteString] -> ByteString
    crlfUnlines [] = ByteString
    B.empty
    crlfUnlines [ByteString]
    ss = [ByteString] -> ByteString
    B.concat ([ByteString] -> ByteString) -> [ByteString] -> ByteString
    forall a b. (a -> b) -> a -> b
    $ ByteString -> [ByteString] -> [ByteString]
    forall a. a -> [a] -> [a]
    intersperse (String -> ByteString
    BC8.pack String
    "\r\n") [ByteString]
    ss

    crlfUnlinesLazy :: [BL.ByteString] -> BL.ByteString
    crlfUnlinesLazy :: [ByteString] -> ByteString
    crlfUnlinesLazy [] = ByteString
    BL.empty
    crlfUnlinesLazy [ByteString]
    ss = [ByteString] -> ByteString
    BL.concat ([ByteString] -> ByteString) -> [ByteString] -> ByteString
    forall a b. (a -> b) -> a -> b
    $ ByteString -> [ByteString] -> [ByteString]
    forall a. a -> [a] -> [a]
    intersperse (String -> ByteString
    BLC8.pack String
    "\r\n") [ByteString]
    ss