{-# 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 (..), BoundedMeetSemiLattice (..), Lattice (..), joinLeq)
import Algebra.PartialOrd (PartialOrd (..))
import Data.Semigroup (Semigroup (..))
import Kleene.Classes
import Kleene.Internal.Pretty
newtype Equiv r c = Equiv (r c)
deriving (Show, Semigroup, Monoid, BoundedJoinSemiLattice, BoundedMeetSemiLattice, Lattice, Pretty)
instance Equivalent c (r c) => Eq (Equiv r c) where
(==) = equivalent
instance (Lattice (r c), Equivalent c (r c)) => PartialOrd (Equiv r c) where
leq = joinLeq
deriving instance Kleene (r c) => Kleene (Equiv r c)
deriving instance CharKleene c (r c) => CharKleene 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)