1
1
mirror of https://github.com/github/semantic.git synced 2024-11-28 10:15:55 +03:00

Give a root name to prettify'.

This commit is contained in:
Rob Rix 2019-06-26 14:00:20 -04:00
parent 1eb9199c58
commit da29ba1bea
No known key found for this signature in database
GPG Key ID: F188A01508EA1CF7

View File

@ -72,8 +72,8 @@ encloseIf False _ _ x = x
newtype P a b = P { getP :: Prec -> a }
newtype K a b = K { getK :: a }
prettify' :: Style -> Core Name -> AnsiDoc
prettify' style = unP 0 . gfold var let' seq' lam app unit bool if' string load edge frame dot assign ann k . fmap (K . name)
prettify' :: Namespaced (Style -> Core Name -> AnsiDoc)
prettify' root style = unP 0 . gfold var let' seq' lam app unit bool if' string load edge frame dot assign ann k . fmap (K . name)
where var = konst . getK
let' a = konst $ keyword "let" <+> name a
a `seq'` b = P $ \ prec ->
@ -175,4 +175,4 @@ appending k item = (keyword k <+>) <$> item
prettyCore :: Style -> Core Name -> AnsiDoc
prettyCore s = run . runNaming (Root "prettyCore") . runReader @Prec 0 . runReader s . prettify
prettyCore s = prettify' s
prettyCore s = prettify' (Root "prettyCore") s