mirror of
https://github.com/github/semantic.git
synced 2025-01-03 04:51:57 +03:00
Rename VarF to Var.
This commit is contained in:
parent
127980698e
commit
7a80201f99
@ -13,7 +13,7 @@ newtype Metavar = Metavar Int
|
||||
|
||||
data BindingF f recur
|
||||
= Let [(Metavar, recur)] (f recur)
|
||||
| VarF Metavar
|
||||
| Var Metavar
|
||||
|
||||
bindings :: BindingF f recur -> [(Metavar, recur)]
|
||||
bindings (Let vars _) = vars
|
||||
@ -32,7 +32,7 @@ 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 _ (Var v1) (Var v2) = v1 == v2
|
||||
liftEq _ _ _ = False
|
||||
|
||||
instance (Eq1 f, Eq a) => Eq (BindingF f a) where
|
||||
@ -41,7 +41,7 @@ instance (Eq1 f, Eq a) => Eq (BindingF f a) where
|
||||
|
||||
instance Show1 f => Show1 (BindingF f) where
|
||||
liftShowsPrec sp sl d (Let vars body) = showsBinaryWith (const (liftShowList sp sl)) (liftShowsPrec sp sl) "Let" d vars body
|
||||
liftShowsPrec _ _ d (VarF var) = showsUnaryWith showsPrec "Var" d var
|
||||
liftShowsPrec _ _ d (Var var) = showsUnaryWith showsPrec "Var" d var
|
||||
|
||||
instance (Show1 f, Show a) => Show (BindingF f a) where
|
||||
showsPrec = showsPrec1
|
||||
@ -54,7 +54,7 @@ instance Pretty1 f => Pretty1 (BindingF f) where
|
||||
liftPretty p pl (Let vars body) = pretty ("let" :: String) <+> align (vsep (prettyKV <$> vars)) <> line
|
||||
<> pretty ("in" :: String) <+> liftPretty p pl body
|
||||
where prettyKV (var, val) = pretty var <+> pretty '=' <+> p val
|
||||
liftPretty _ _ (VarF metavar) = pretty metavar
|
||||
liftPretty _ _ (Var metavar) = pretty metavar
|
||||
|
||||
instance (Pretty1 f, Pretty a) => Pretty (BindingF f a) where
|
||||
pretty = liftPretty pretty prettyList
|
||||
@ -62,7 +62,7 @@ instance (Pretty1 f, Pretty a) => Pretty (BindingF f a) where
|
||||
|
||||
instance ToJSONFields1 f => ToJSONFields1 (BindingF f) where
|
||||
toJSONFields1 (Let vars body) = [ "vars" .= vars ] <> toJSONFields1 body
|
||||
toJSONFields1 (VarF v) = [ "metavar" .= v ]
|
||||
toJSONFields1 (Var v) = [ "metavar" .= v ]
|
||||
|
||||
instance (ToJSON a, ToJSONFields1 f) => ToJSON (BindingF f a) where
|
||||
toJSON = object . toJSONFields1
|
||||
|
Loading…
Reference in New Issue
Block a user