    -- |
    -- Module      : Data.PEM.Types
    -- License     : BSD-style
    -- Maintainer  : Vincent Hanquez <vincent@snarc.org>
    -- Stability   : experimental
    -- Portability : portable
    --
    module Data.PEM.Types where

    import Data.ByteString (ByteString)
    import Basement.NormalForm

    -- | Represent one PEM section
    --
    -- for now headers are not serialized at all.
    -- this is just available here as a placeholder for a later implementation.
    data PEM = PEM
        { PEM -> String
    pemName    :: String                 -- ^ the name of the section, found after the dash BEGIN tag.
        , PEM -> [(String, ByteString)]
    pemHeader  :: [(String, ByteString)] -- ^ optionals key value pair header
        , PEM -> ByteString
    pemContent :: ByteString             -- ^ binary content of the section
        } deriving (Int -> PEM -> ShowS
    [PEM] -> ShowS
    PEM -> String
    (Int -> PEM -> ShowS)
    -> (PEM -> String) -> ([PEM] -> ShowS) -> Show PEM
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    showList :: [PEM] -> ShowS
    $cshowList :: [PEM] -> ShowS
    show :: PEM -> String
    $cshow :: PEM -> String
    showsPrec :: Int -> PEM -> ShowS
    $cshowsPrec :: Int -> PEM -> ShowS
    Show,PEM -> PEM -> Bool
    (PEM -> PEM -> Bool) -> (PEM -> PEM -> Bool) -> Eq PEM
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    /= :: PEM -> PEM -> Bool
    $c/= :: PEM -> PEM -> Bool
    == :: PEM -> PEM -> Bool
    $c== :: PEM -> PEM -> Bool
    Eq)

    instance NormalForm PEM where
        toNormalForm :: PEM -> ()
    toNormalForm pem :: PEM
    pem =
            String -> ()
    forall a. NormalForm a => a -> ()
    toNormalForm (PEM -> String
    pemName PEM
    pem) () -> () -> ()
    forall a b. a -> b -> b
    `seq` [(String, ByteString)] -> ()
    forall a t. NormalForm a => [(a, t)] -> ()
    nfLbs (PEM -> [(String, ByteString)]
    pemHeader PEM
    pem) () -> () -> ()
    forall a b. a -> b -> b
    `seq` PEM -> ByteString
    pemContent PEM
    pem ByteString -> () -> ()
    forall a b. a -> b -> b
    `seq` ()
          where
            nfLbs :: [(a, t)] -> ()
    nfLbs []         = ()
            nfLbs ((s :: a
    s,bs :: t
    bs):l :: [(a, t)]
    l) = a -> ()
    forall a. NormalForm a => a -> ()
    toNormalForm a
    s () -> () -> ()
    forall a b. a -> b -> b
    `seq` t
    bs t -> () -> ()
    forall a b. a -> b -> b
    `seq` [(a, t)] -> ()
    nfLbs [(a, t)]
    l