X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;f=CoreTools.hs;h=3a028195634a61100e47ae9322df72138688e8e9;hb=87bdc71306c507319ff560d3dd3253e17e9c46fe;hp=bd6f329c537ea93842bf5b221998cf47fb69085c;hpb=57b95a135792cc76493402f716e33cbf9853b5c4;p=matthijs%2Fmaster-project%2Fc%CE%BBash.git diff --git a/CoreTools.hs b/CoreTools.hs index bd6f329..3a02819 100644 --- a/CoreTools.hs +++ b/CoreTools.hs @@ -38,9 +38,10 @@ import Pretty -- | Evaluate a core Type representing type level int from the tfp -- library to a real int. -eval_tfp_int :: Type.Type -> Int -eval_tfp_int ty = +eval_tfp_int :: HscTypes.HscEnv -> Type.Type -> Int +eval_tfp_int env ty = unsafeRunGhc $ do + GHC.setSession env -- Automatically import modules for any fully qualified identifiers setDynFlag DynFlags.Opt_ImplicitImportQualified @@ -56,9 +57,7 @@ eval_tfp_int ty = let letexpr = HsExpr.HsLet (HsBinds.HsValBinds $ (HsBinds.ValBindsIn binds) []) (SrcLoc.noLoc expr) - - let modules = map GHC.mkModuleName ["Types.Data.Num"] - core <- toCore modules expr + core <- toCore expr execCore core normalise_tfp_int :: HscTypes.HscEnv -> Type.Type -> Type.Type