mirror of
https://github.com/github/semantic.git
synced 2024-12-22 14:21:31 +03:00
Define an Eq1 instance for BindingF.
This commit is contained in:
parent
ad83303071
commit
bc7ed4420e
@ -2,6 +2,7 @@
|
||||
module Data.Functor.Binding where
|
||||
|
||||
import Data.Aeson (KeyValue(..), ToJSON)
|
||||
import Data.Functor.Classes
|
||||
import Data.JSON.Fields
|
||||
import Data.Text.Prettyprint.Doc
|
||||
|
||||
@ -25,6 +26,12 @@ envLookup :: Metavar -> Env a -> Maybe a
|
||||
envLookup var = lookup var . unEnv
|
||||
|
||||
|
||||
instance Eq1 f => Eq1 (BindingF f) where
|
||||
liftEq eq (Let v1 b1) (Let v2 b2) = liftEq (liftEq eq) v1 v2 && liftEq eq b1 b2
|
||||
liftEq _ (VarF v1) (VarF v2) = v1 == v2
|
||||
liftEq _ _ _ = False
|
||||
|
||||
|
||||
instance Pretty Metavar where
|
||||
pretty (Metavar v) = pretty v
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user