Eq, Ord instances for Syntax

This commit is contained in:
Dmitry Zuikov 2023-03-26 10:23:20 +03:00
parent b017bc1e9d
commit 3fbf491a78
2 changed files with 7 additions and 1 deletions

View File

@ -27,7 +27,9 @@ data MegaParsec =
MegaParsec MegaParsec
deriving (Data,Typeable,Generic) deriving (Data,Typeable,Generic)
newtype instance Context MegaParsec = MegaContext (Maybe Int) newtype instance Context MegaParsec =
MegaContext (Maybe Int)
deriving (Eq,Ord,Generic)
instance IsContext MegaParsec where instance IsContext MegaParsec where
noContext = MegaContext Nothing noContext = MegaContext Nothing

View File

@ -81,6 +81,10 @@ data Syntax c
| Literal (Context c) Literal | Literal (Context c) Literal
deriving stock (Generic) deriving stock (Generic)
deriving instance Eq (Context c) => Eq (Syntax c)
deriving instance Ord (Context c) => Ord (Syntax c)
instance HasContext c (Syntax c) where instance HasContext c (Syntax c) where
setContext c1 = \case setContext c1 = \case
List _ v -> List c1 v List _ v -> List c1 v