{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE Trustworthy #-}
{-# LANGUAGE UndecidableInstances #-}
module Kleene.Equiv where
import Prelude ()
import Prelude.Compat
import Algebra.Lattice
(BoundedJoinSemiLattice (..), JoinSemiLattice (..), joinLeq)
import Algebra.PartialOrd (PartialOrd (..))
import Kleene.Classes
import Kleene.Internal.Pretty
newtype Equiv r c = Equiv (r c)
deriving (Show, Semigroup, Monoid, BoundedJoinSemiLattice, JoinSemiLattice, Pretty)
instance Equivalent c (r c) => Eq (Equiv r c) where
(==) = equivalent
instance (JoinSemiLattice (r c), Equivalent c (r c)) => PartialOrd (Equiv r c) where
leq = joinLeq
deriving instance Kleene c (r c) => Kleene c (Equiv r c)
deriving instance Derivate c (r c) => Derivate c (Equiv r c)
deriving instance Match c (r c) => Match c (Equiv r c)
deriving instance Equivalent c (r c) => Equivalent c (Equiv r c)
deriving instance Complement c (r c) => Complement c (Equiv r c)