From bc7ed4420e9851bf4bea40ee8ec44291a8bf90e9 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Sun, 10 Sep 2017 21:47:43 -0400 Subject: [PATCH] Define an Eq1 instance for BindingF. --- src/Data/Functor/Binding.hs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Data/Functor/Binding.hs b/src/Data/Functor/Binding.hs index 298cbdf62..34996cfca 100644 --- a/src/Data/Functor/Binding.hs +++ b/src/Data/Functor/Binding.hs @@ -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