Safe Haskell | Safe-Inferred |
---|
Parse the output of ghci's :history
command.
- parseHistory :: String -> Either String [HistoryItem]
Documentation
parseHistory :: String -> Either String [HistoryItem]Source
Given a string containing the output of the ghci :history
command, parse it using Text.Parsec, if available,
otherwise Text.ParserCombinators.ReadP.
Returns either an error message, or a list of HistoryItem
s.
Examples
>>>
:{
let myHistory = unlines [ "-1 : fib (src/Stuff.hs:52:8-16)" , "<end of history>" ] :}
>>>
parseHistory myHistory
Right [HistoryItem {histStepNum = -1, funcName = "fib", fileName = "src/Stuff.hs", startPos = FilePos {lineNum = 52, colNum = 8}, endPos = FilePos {lineNum = 52, colNum = 16}}]