module Common.Lattice where
class (Ord l, Show l) => Lattice l where
cjoin :: l -> l -> l
ctop :: l
bot :: l
instance Lattice () where
cjoin :: () -> () -> ()
cjoin _ _ = ()
ctop :: ()
ctop = ()
bot :: ()
bot = ()
instance Lattice Bool where
cjoin :: Bool -> Bool -> Bool
cjoin = Bool -> Bool -> Bool
(||)
ctop :: Bool
ctop = Bool
True
bot :: Bool
bot = Bool
False
instance (Lattice a, Lattice b) => Lattice (a, b) where
cjoin :: (a, b) -> (a, b) -> (a, b)
cjoin (a :: a
a, b :: b
b) (c :: a
c, d :: b
d) = (a -> a -> a
forall l. Lattice l => l -> l -> l
cjoin a
a a
c, b -> b -> b
forall l. Lattice l => l -> l -> l
cjoin b
b b
d)
ctop :: (a, b)
ctop = (a
forall l. Lattice l => l
ctop, b
forall l. Lattice l => l
ctop)
bot :: (a, b)
bot = (a
forall l. Lattice l => l
bot, b
forall l. Lattice l => l
bot)