git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Typecheck main in PSCi (#2163)
commit2bafbae807e9a4cac69bb3f7cbb21279f90bda3b authorPhil Freeman <paf31@cantab.net> dateSat 28 May 2016, 13:23 (10 years ago) parent2ca82f8
1 file changed+15−2
src/Language/PureScript/Interactive/Module.hs+15−2
src/Language/PureScript/Interactive/Module.hs+15−2
@@ -45,14 +45,27 @@ createTemporaryModule :: Bool -> PSCiState -> P.Expr -> P.Module
4545createTemporaryModule exec PSCiState{psciImportedModules = imports, psciLetBindings = lets} val =
4646 let
4747 moduleName = P.ModuleName [P.ProperName "$PSCI"]
48+ effModuleName = P.moduleNameFromString "Control.Monad.Eff"
49+ effImport = (effModuleName, P.Implicit, Just (P.ModuleName [P.ProperName "$Eff"]))
4850 supportImport = (supportModuleName, P.Implicit, Just (P.ModuleName [P.ProperName "$Support"]))
4951 eval = P.Var (P.Qualified (Just (P.ModuleName [P.ProperName "$Support"])) (P.Ident "eval"))
5052 mainValue = P.App eval (P.Var (P.Qualified Nothing (P.Ident "it")))
5153 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))
5261 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>"
5464 in
55− P.Module (P.internalModuleSourceSpan "<internal>") [] moduleName ((importDecl `map` (supportImport : imports)) ++ lets ++ decls) Nothing
65+ P.Module internalSpan
66+ [] moduleName
67+ ((importDecl `map` (effImport : supportImport : imports)) ++ lets ++ decls)
68+ Nothing
5669
5770
5871-- |