forked from GitHub/gf-core
haskell-bind: change the type of CRuntimeFFI.getConcr
Change the type of getConcr from
getConcr :: PGF -> Language -> Concr
to
getConcr :: PGF -> Language -> Maybe Concr
This is to prevent programs from crashing later if you try to select a
concrete syntax that is not present in a grammar.
This commit is contained in:
@@ -72,11 +72,11 @@ readPGF filepath =
|
||||
return PGF {pgfPool = pool, pgf = pgf}
|
||||
|
||||
|
||||
getConcr :: PGF -> Language -> Concr
|
||||
getConcr :: PGF -> Language -> Maybe Concr
|
||||
getConcr p (CId lang) = unsafePerformIO $
|
||||
BS.useAsCString lang $ \lng -> do
|
||||
cnc <- pgf_get_language (pgf p) lng
|
||||
return (Concr cnc p)
|
||||
return (if cnc==nullPtr then Nothing else Just (Concr cnc p))
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user