Changeset 7591
- Timestamp:
- 10/13/05 13:14:33 (3 years ago)
- Location:
- src/Pugs
- Files:
-
- 5 modified
-
AST/Internals.hs (modified) (1 diff)
-
Compile.hs (modified) (1 diff)
-
Eval/Var.hs (modified) (1 diff)
-
Parser.hs (modified) (3 diffs)
-
Prim/List.hs (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/Pugs/AST/Internals.hs
r7590 r7591 1287 1287 1288 1288 findSym :: String -> Pad -> Maybe (TVar VRef) 1289 findSym name pad = liftMhead (lookupPad name pad)1289 findSym name pad = fmap head (lookupPad name pad) 1290 1290 1291 1291 instance MonadEval Eval -
src/Pugs/Compile.hs
r7579 r7591 79 79 entries = sortBy padSort $ padToList pad 80 80 canCompile (name@('&':_), xs) | length xs > 1 = do 81 liftMconcat $ mapM (\x -> canCompile (name, [x])) xs81 fmap concat $ mapM (\x -> canCompile (name, [x])) xs 82 82 canCompile (name@('&':_), [(_, sym)]) = do 83 83 ref <- liftSTM $ readTVar sym -
src/Pugs/Eval/Var.hs
r7579 r7591 271 271 _ -> Nothing 272 272 subs :: Int -> [(String, Val)] -> Eval [((Bool, Bool, Int, Int), VCode)] 273 subs slurpLen subSyms = (liftM catMaybes) $ (`mapM` subSyms)$ \(_, val) -> do273 subs slurpLen subSyms = fmap catMaybes . forM subSyms $ \(_, val) -> do 274 274 sub@(MkCode{ subReturns = ret, subParams = prms }) <- fromVal val 275 275 let rv = return $ arityMatch sub (length (maybeToList invs ++ args)) slurpLen -
src/Pugs/Parser.hs
r7579 r7591 1576 1576 nameExps <- many1 $ do 1577 1577 string "::" 1578 (parens ruleExpression) <|> ( liftM(Val . VStr . concat) $ sequence [ruleTwigil, many1 wordAny])1578 (parens ruleExpression) <|> (fmap (Val . VStr . concat) $ sequence [ruleTwigil, many1 wordAny]) 1579 1579 -- Optimization: We don't have to construct a symbolic deref syn (":::()"), 1580 1580 -- but can use a simple Var, if nameExps consists of only one expression … … 1967 1967 -- XXX: This looks slightly odd to me -- is one forced to say 1968 1968 -- $::("?SELF") instead? 1969 (parens ruleExpression) <|> ( liftM(Val . VStr) $ do1969 (parens ruleExpression) <|> (fmap (Val . VStr) $ do 1970 1970 choice 1971 1971 [ string "!" -- $! 1972 1972 , string "/" -- $/ 1973 , liftMconcat $ sequence [ruleTwigil, many1 wordAny] ])1973 , fmap concat $ sequence [ruleTwigil, many1 wordAny] ]) 1974 1974 return $ Syn (sigil:"::()") nameExps 1975 1975 … … 2169 2169 qLiteral1 qStart qEnd flags 2170 2170 else do -- XXX an ugly kludge providing crude heredocs 2171 endMarker <- ( liftM (string)$ many1 wordAny)2171 endMarker <- (fmap string $ many1 wordAny) 2172 2172 qEnd; ruleWhiteSpaceLine 2173 2173 qLiteral1 (fail "never match") endMarker flags -
src/Pugs/Prim/List.hs
r6793 r7591 220 220 op2Map list sub = do 221 221 args <- fromVal list 222 arity <- liftMlength $ (fromVal sub >>= return . subParams)222 arity <- fmap length $ (fromVal sub >>= return . subParams) 223 223 evl <- asks envEval 224 224 vals <- mapMn args arity $ \x -> do
