@@ -47,12 +47,12 @@ completion ms = completeWord Nothing " \t\n\r" findCompletions
4747 findCompletions :: String -> IO [Completion]
4848 findCompletions str = do
4949 files <- listFiles str
50− let names = nub $ [ show qual
51− | P.Module moduleName ds <- ms
52− , ident <- mapMaybe getDeclName ds
53− , qual <- [ P.Qualified Nothing ident
54− , P.Qualified (Just (P.ModuleName moduleName)) ident]
55− ]
50+ let names = nub [ show qual
51+ | P.Module moduleName ds <- ms
52+ , ident <- mapMaybe getDeclName ds
53+ , qual <- [ P.Qualified Nothing ident
54+ , P.Qualified (Just (P.ModuleName moduleName)) ident]
55+ ]
5656 let matches = filter (isPrefixOf str) names
5757 return $ map simpleCompletion matches ++ files
5858 getDeclName :: P.Declaration -> Maybe P.Ident
@@ -66,8 +66,9 @@ createTemporaryModule imports value =
6666 importDecl m = P.ImportDeclaration m Nothing
6767 traceModule = P.ModuleName (P.ProperName "Trace")
6868 trace = P.Var (P.Qualified (Just traceModule) (P.Ident "print"))
69+ returnedValue = P.App (P.Var (P.Qualified Nothing (P.Ident "return"))) value
6970 mainDecl = P.ValueDeclaration (P.Ident "main") [] Nothing
70− (P.Do [ P.DoNotationBind (P.VarBinder (P.Ident "it")) value
71+ (P.Do [ P.DoNotationBind (P.VarBinder (P.Ident "it")) returnedValue
7172 , P.DoNotationValue (P.App trace (P.Var (P.Qualified Nothing (P.Ident "it"))) )
7273 ])
7374 in
@@ -140,8 +141,7 @@ main = do
140141 case cmd of
141142 Empty -> go imports loadedModules
142143 Expression ls -> do
143− let returned = unlines $ ["return ("] ++ ls ++ [")"]
144− case P.runIndentParser "" (P.whiteSpace *> P.parseValue <* Parsec.eof) returned of
144+ case P.runIndentParser "" (P.whiteSpace *> P.parseValue <* Parsec.eof) (unlines ls) of
145145 Left err -> outputStrLn (show err)
146146 Right decl -> handleDeclaration loadedModules imports decl
147147 go imports loadedModules