forked from GitHub/gf-core
added showContext
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -78,6 +78,8 @@ foreign import ccall pgf_read_expr_ex :: Ptr PgfText -> Ptr CString -> Ptr PgfUn
|
||||
foreign import ccall "pgf_print_type"
|
||||
pgf_print_type :: StablePtr Type -> Ptr PgfPrintContext -> CInt -> Ptr PgfMarshaller -> IO (Ptr PgfText)
|
||||
|
||||
foreign import ccall pgf_print_context :: CSize -> Ptr PgfTypeHypo -> Ptr PgfPrintContext -> CInt -> Ptr PgfMarshaller -> IO (Ptr PgfText)
|
||||
|
||||
foreign import ccall "pgf_read_type"
|
||||
pgf_read_type :: Ptr PgfText -> Ptr PgfUnmarshaller -> IO (StablePtr Type)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user