module LIO.DCLabel.Serialize () where
import LIO.DCLabel.Core
import Data.Serialize
import Control.Monad
deriving instance Serialize Principal
deriving instance Serialize Clause
instance Serialize Component where
put c = put . dcToMaybe $! c
where dcToMaybe DCFalse = Nothing
dcToMaybe (DCFormula f) = Just f
get = dcFromMaybe `liftM` get
where dcFromMaybe Nothing = dcFalse
dcFromMaybe (Just f) = dcFormula f
instance Serialize DCLabel where
put l = put (dcSecrecy l, dcIntegrity l)
get = uncurry dcLabelNoReduce `liftM` get