module LIO.DCLabel.Serialize () where
import LIO.DCLabel.Core
import Data.Binary
import Control.Monad
deriving instance Binary Principal
deriving instance Binary Clause
instance Binary 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 Binary DCLabel where
put l = put (dcSecrecy l, dcIntegrity l)
get = uncurry dcLabelNoReduce `liftM` get