added showContext

This commit is contained in:
krangelov
2021-09-14 19:10:01 +02:00
parent 3675e5cfc6
commit a7bf47cb87
6 changed files with 51 additions and 18 deletions

View File

@@ -912,7 +912,13 @@ showType scope ty =
peekText c_text
showContext :: [Var] -> [(BindType,Var,Type)] -> String
showContext = error "TODO: showContext"
showContext scope hypos =
unsafePerformIO $
withHypos hypos $ \n_hypos c_hypos ->
bracket (newPrintCtxt scope) freePrintCtxt $ \pctxt ->
withForeignPtr marshaller $ \m ->
bracket (pgf_print_context n_hypos c_hypos pctxt 0 m) free $ \c_text ->
peekText c_text
-- | parses a 'String' as a type
readType :: String -> Maybe Type