git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Rename binder -> let.
commit68f9eb34ec2f9179096c305537a7bf2b9b65e41d authorjoneshf <jones3.hardy@gmail.com> dateWed 19 Feb 2014, 11:07 (13 years ago) parent3d954fe
1 file changed+11−11
psci/Main.hs+11−11
psci/Main.hs+11−11
@@ -54,8 +54,8 @@ updateImports name (PSCI i m b) = PSCI (i ++ [P.ProperName name]) m b
5454updateModules :: [P.Module] -> PSCI -> PSCI
5555updateModules modules (PSCI i m b) = PSCI i (m ++ modules) b
5656
57−updateBinders :: (P.Value -> P.Value) -> PSCI -> PSCI
58−updateBinders name (PSCI i m b) = PSCI i m (b ++ [name])
57+updateLets :: (P.Value -> P.Value) -> PSCI -> PSCI
58+updateLets name (PSCI i m b) = PSCI i m (b ++ [name])
5959
6060-- File helpers
6161defaultImports :: [P.ProperName]
@@ -122,20 +122,20 @@ options :: P.Options
122122options = P.Options True False True (Just "Main") True "PS" []
123123
124124createTemporaryModule :: [P.ProperName] -> [P.Value -> P.Value] -> P.Value -> P.Module
125−createTemporaryModule imports binders value =
125+createTemporaryModule imports lets value =
126126 let
127127 moduleName = P.ModuleName [P.ProperName "Main"]
128128 importDecl m = P.ImportDeclaration m Nothing
129129 traceModule = P.ModuleName [P.ProperName "Trace"]
130130 trace = P.Var (P.Qualified (Just traceModule) (P.Ident "print"))
131− value' = foldr ($) value binders
131+ value' = foldr ($) value lets
132132 mainDecl = P.ValueDeclaration (P.Ident "main") [] Nothing (P.App trace value')
133133 in
134134 P.Module moduleName $ map (importDecl . P.ModuleName . return) imports ++ [mainDecl]
135135
136136handleDeclaration :: P.Value -> PSCI -> InputT IO ()
137−handleDeclaration value (PSCI imports loadedModules binders) = do
138− let m = createTemporaryModule imports binders value
137+handleDeclaration value (PSCI imports loadedModules lets) = do
138+ let m = createTemporaryModule imports lets value
139139 case P.compile options (loadedModules ++ [m]) of
140140 Left err -> outputStrLn err
141141 Right (js, _, _) -> do
@@ -147,9 +147,9 @@ handleDeclaration value (PSCI imports loadedModules binders) = do
147147 Nothing -> outputStrLn "Couldn't find node.js"
148148
149149-- Parser helpers
150−parseDoNotationLet :: Parsec.Parsec String P.ParseState (P.Value -> P.Value)
151−parseDoNotationLet = P.Let <$> (P.reserved "let" *> P.indented *> P.parseBinder)
152− <*> (P.indented *> P.reservedOp "=" *> P.parseValue)
150+parseLet :: Parsec.Parsec String P.ParseState (P.Value -> P.Value)
151+parseLet = P.Let <$> (P.reserved "let" *> P.indented *> P.parseBinder)
152+ <*> (P.indented *> P.reservedOp "=" *> P.parseValue)
153153
154154parseExpression :: Parsec.Parsec String P.ParseState P.Value
155155parseExpression = P.whiteSpace *> P.parseValue <* Parsec.eof
@@ -158,12 +158,12 @@ parseExpression = P.whiteSpace *> P.parseValue <* Parsec.eof
158158handleCommand :: Command -> StateT PSCI (InputT IO) ()
159159handleCommand Empty = return ()
160160handleCommand (Expression ls) =
161− case P.runIndentParser "" parseDoNotationLet (unlines ls) of
161+ case P.runIndentParser "" parseLet (unlines ls) of
162162 Left _ ->
163163 case P.runIndentParser "" parseExpression (unlines ls) of
164164 Left err -> inputTToState $ outputStrLn (show err)
165165 Right decl -> get >>= inputTToState . handleDeclaration decl
166− Right binder -> modify (updateBinders binder)
166+ Right l -> modify (updateLets l)
167167handleCommand Help = inputTToState $ outputStrLn helpMessage
168168handleCommand (Import moduleName) = modify (updateImports moduleName)
169169handleCommand (LoadFile filePath) = do