git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Typecheck main in PSCi (#2163)
2bafbaePhil Freeman
src/Language/PureScript/Interactive/Module.hs+15−2
@@ -45,14 +45,27 @@ createTemporaryModule :: Bool -> PSCiState -> P.Expr -> P.Module
45createTemporaryModule exec PSCiState{psciImportedModules = imports, psciLetBindings = lets} val =
45createTemporaryModule exec PSCiState{psciImportedModules = imports, psciLetBindings = lets} val =
46 let
46 let
47 moduleName = P.ModuleName [P.ProperName "$PSCI"]
47 moduleName = P.ModuleName [P.ProperName "$PSCI"]
48+ effModuleName = P.moduleNameFromString "Control.Monad.Eff"
49+ effImport = (effModuleName, P.Implicit, Just (P.ModuleName [P.ProperName "$Eff"]))
48 supportImport = (supportModuleName, P.Implicit, Just (P.ModuleName [P.ProperName "$Support"]))
50 supportImport = (supportModuleName, P.Implicit, Just (P.ModuleName [P.ProperName "$Support"]))
49 eval = P.Var (P.Qualified (Just (P.ModuleName [P.ProperName "$Support"])) (P.Ident "eval"))
51 eval = P.Var (P.Qualified (Just (P.ModuleName [P.ProperName "$Support"])) (P.Ident "eval"))
50 mainValue = P.App eval (P.Var (P.Qualified Nothing (P.Ident "it")))
52 mainValue = P.App eval (P.Var (P.Qualified Nothing (P.Ident "it")))
51 itDecl = P.ValueDeclaration (P.Ident "it") P.Public [] $ Right val
53 itDecl = P.ValueDeclaration (P.Ident "it") P.Public [] $ Right val
54+ typeDecl = P.TypeDeclaration (P.Ident "$main")
55+ (P.TypeApp
56+ (P.TypeApp
57+ (P.TypeConstructor
58+ (P.Qualified (Just (P.ModuleName [P.ProperName "$Eff"])) (P.ProperName "Eff")))
59+ (P.TypeWildcard internalSpan))
60+ (P.TypeWildcard internalSpan))
52 mainDecl = P.ValueDeclaration (P.Ident "$main") P.Public [] $ Right mainValue
61 mainDecl = P.ValueDeclaration (P.Ident "$main") P.Public [] $ Right mainValue
53− decls = if exec then [itDecl, mainDecl] else [itDecl]
62+ decls = if exec then [itDecl, typeDecl, mainDecl] else [itDecl]
63+ internalSpan = P.internalModuleSourceSpan "<internal>"
54 in
64 in
65+ P.Module internalSpan
66+ [] moduleName
55− P.Module (P.internalModuleSourceSpan "<internal>") [] moduleName ((importDecl `map` (supportImport : imports)) ++ lets ++ decls) Nothing
67+ ((importDecl `map` (effImport : supportImport : imports)) ++ lets ++ decls)
68+ Nothing
56
69
57
70
58-- |
71-- |