ghci-history-parser-0.1.0.2: parse output of ghci ":history" command

Safe HaskellSafe-Inferred

GHCi.History.Parse

Description

Parse the output of ghci's :history command.

Synopsis

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 HistoryItems.

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}}]