alevy/hails — comment on commit b12ace9532f0bf04de99b1275467272a90e98b9d
File: Hails/Database/MongoDB/TCB/DCAccess.hs line 128
By deian:

Can safely ignore this, but in playing around I wrote this. Maybe it's
useful, maybe not. Point: I tried to avoid use of constructors when possible.
(P.S. I comented out the db stuff when playing with this so it might
not directly typecheck)

where expandComponent _ l | l == (><) = return l
expandComponent p comp = do
ds <- mapM (gocmp p) $ componentToList comp
return $ listToComponent ds
gocmp p d = do
let db = policyDB dbp
result <-
if p `owns` d
then dcAccess db $ liftM listToDisj $ do
foldM (\res grp -> do next <- expandGroup dbp grp
return $ res ++ next) [] $ disjToList d
else return d
return $ case result of
Right dr -> dr
Left _ -> d