Open lspitzner opened 8 years ago
This ticket is tracking the GHC issue -- https://ghc.haskell.org/trac/ghc/ticket/10961?cversion=0&cnum_hist=1
I just unsafePerfromIO on the wrapper and have never encountered meaningful problems. The part which is used by the parser is not initialised in IO and so there shouldn't be any problems.
The differences i observed between parseWith [..] GHC.parseModule ..
and parseModule
are:
parseWith
does not respect LANGUAGE
pragmas.parseWith
does not return annotations, i guess because i did not set GHC.Opt_KeepRawTokenStream
, which happens as part of the unexposed initDynFlags
when using parseModule
.I'll make a PR in a sec.
If you are parsing a whole module, have you tried using parseModule
?
Yes. However, parseModule
is fundamentally impure, reading the source from some file. This difference threads through the internal functions, too.
parseDynamicFilePragma
.
Imo the
unsafeGlobalDynFlags
justify adding a pure wrapper, because "unsafe" and no real documentation that i can find if it is ok to use them.This probably needs ghc-api additions, like a pure
parseDynamicFilePragma
.