File: Utils.hs

package info (click to toggle)
haskell-openpgp-asciiarmor 0.1.2-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 156 kB
  • sloc: haskell: 395; makefile: 3
file content (24 lines) | stat: -rw-r--r-- 818 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
-- 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 [] = B.empty
crlfUnlines ss = B.concat $ intersperse (BC8.pack "\r\n") ss

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