(actually, :redir =>variable | commands | :redir END)This is fine, but if we were to do this properly I would still go for a syntax likeoutput <- :browse M which avoids the problems with your earlier solution.
that would seem an odd mixture of haskell and ghci syntax. i'd prefer to keep the two separate, and the vim commandline syntax has evolved and been tested over a long time (for instance, one can have a sequence of commands within a redirection, one can redirect to a variable or file, one can create or append, ..). as long as we're doing single commands only, i've finally figured out how to switch off the output relating to the redirection code: -fno-print-bind-result could this option please be mentioned in user guide 3.7.2? i suspected that ghci had something similar to hugs [+-]I, but even though, it took me a long time to find that option. it is mentioned in passing, in 3.4.2even the source code is rather cryptic, thanks to multiple redirections and slightly misleading comments: both HscMain.lhs and TcRnDriver.lhs have similar comments claiming that expressions of IO type are never printed and
giving no indication that bindings are printed, let alone that there's an option to control the latter. also, hscStmt claims to do the translation that is actually delegated to mkPlan(via tcRnStmt, how could i have guessed that?), where i finally saw the option i wanted..
anyway, i can now do things like the examples below, with the ghci definitions attached. so i guess that closesthe output capture part of the feature requests.
i get the feeling that ghci commands could do with an overhaul (:set reports options, but not flag settings; a :def! that overrides existing :def would be nicer than the:undef/:def idiom; also, :def <command> without rhs should echo the current definition, if any, and :def without command or rhs should list user-defined commands; perhaps :help <command> text could add help for user-defined commands? passing computed Strings to commands is
awkward; is there a way to write multi-line definitions? etc etc). lots of smallish things that could make life easier. claus *Main> :find main -- opens editor on the definition of Main.main *Main> :grep fold :browse Prelude foldr :: (a -> b -> b) -> b -> [a] -> b foldl :: (a -> b -> a) -> a -> [b] -> a foldr1 :: (a -> a -> a) -> [a] -> a foldl1 :: (a -> a -> a) -> [a] -> a *Main> :grep module :? :add <filename> ... add module(s) to the current target set :browse[!] [*]<module> display the names defined by <module> :edit edit last module :load <filename> ... load module(s) and their dependents :module [+/-] [*]<mod> ... set the context for expression evaluation :reload reload the current module set :stepmodule single-step restricted to the current module :show modules show the currently loaded modules *Main> :grep Bool :browse Data.List filter :: (a -> Bool) -> [a] -> [a] all :: (a -> Bool) -> [a] -> Bool and :: [Bool] -> Bool any :: (a -> Bool) -> [a] -> Bool break :: (a -> Bool) -> [a] -> ([a], [a]) dropWhile :: (a -> Bool) -> [a] -> [a] elem :: (Eq a) => a -> [a] -> Bool notElem :: (Eq a) => a -> [a] -> Bool null :: [a] -> Bool or :: [Bool] -> Bool span :: (a -> Bool) -> [a] -> ([a], [a]) takeWhile :: (a -> Bool) -> [a] -> [a] groupBy :: (a -> a -> Bool) -> [a] -> [[a]] nubBy :: (a -> a -> Bool) -> [a] -> [a] unionBy :: (a -> a -> Bool) -> [a] -> [a] -> [a] deleteBy :: (a -> a -> Bool) -> a -> [a] -> [a] isPrefixOf :: (Eq a) => [a] -> [a] -> Bool findIndices :: (a -> Bool) -> [a] -> [Int] find :: (a -> Bool) -> [a] -> Maybe a findIndex :: (a -> Bool) -> [a] -> Maybe Int isSuffixOf :: (Eq a) => [a] -> [a] -> Bool isInfixOf :: (Eq a) => [a] -> [a] -> Bool intersectBy :: (a -> a -> Bool) -> [a] -> [a] -> [a] partition :: (a -> Bool) -> [a] -> ([a], [a]) deleteFirstsBy :: (a -> a -> Bool) -> [a] -> [a] -> [a]
cmds.ghci
Description: Binary data
_______________________________________________ Cvs-ghc mailing list [email protected] http://www.haskell.org/mailman/listinfo/cvs-ghc
