From 82897fa5e9b13ad386b6ef6e6bdb3d045a793a84 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Sun, 10 Sep 2017 21:41:41 -0400 Subject: [PATCH] Define a Pretty1 instance for BindingF. --- src/Data/Functor/Binding.hs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Data/Functor/Binding.hs b/src/Data/Functor/Binding.hs index dddf032ee..5e5b5759d 100644 --- a/src/Data/Functor/Binding.hs +++ b/src/Data/Functor/Binding.hs @@ -26,3 +26,9 @@ envLookup var = lookup var . unEnv instance Pretty Metavar where pretty (Metavar v) = pretty v + +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