projects
/
matthijs
/
master-project
/
cλash.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
No longer any need to explicitly load module interface in 'toCore'
[matthijs/master-project/cλash.git]
/
CoreTools.hs
diff --git
a/CoreTools.hs
b/CoreTools.hs
index eae4122deff7425570ea5b232d4545ede76d46ac..3a028195634a61100e47ae9322df72138688e8e9 100644
(file)
--- 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.
-- | 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
unsafeRunGhc $ do
+ GHC.setSession env
-- Automatically import modules for any fully qualified identifiers
setDynFlag DynFlags.Opt_ImplicitImportQualified
-- 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 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
execCore core
normalise_tfp_int :: HscTypes.HscEnv -> Type.Type -> Type.Type
@@
-222,4
+221,4
@@
getLiterals :: CoreSyn.CoreExpr -> [CoreSyn.CoreExpr]
getLiterals app@(CoreSyn.App _ _) = literals
where
(CoreSyn.Var f, args) = CoreSyn.collectArgs app
getLiterals app@(CoreSyn.App _ _) = literals
where
(CoreSyn.Var f, args) = CoreSyn.collectArgs app
- literals = filter (is_lit) args
\ No newline at end of file
+ literals = filter (is_lit) args