module Data.PEM.Types where
import Data.ByteString (ByteString)
import Basement.NormalForm
data PEM = PEM
{ PEM -> String
pemName :: String
, :: [(String, ByteString)]
, PEM -> ByteString
pemContent :: ByteString
} 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 =
String -> ()
forall a. NormalForm a => a -> ()
toNormalForm (PEM -> String
pemName PEM
pem) () -> () -> ()
`seq` [(String, ByteString)] -> ()
forall a a. NormalForm a => [(a, a)] -> ()
nfLbs (PEM -> [(String, ByteString)]
pemHeader PEM
pem) () -> () -> ()
`seq` PEM -> ByteString
pemContent PEM
pem ByteString -> () -> ()
`seq` ()
where
nfLbs :: [(a, a)] -> ()
nfLbs [] = ()
nfLbs ((a
s,a
bs):[(a, a)]
l) = a -> ()
forall a. NormalForm a => a -> ()
toNormalForm a
s () -> () -> ()
`seq` a
bs a -> () -> ()
`seq` [(a, a)] -> ()
nfLbs [(a, a)]
l