1module AST.Annotation where
3import qualified Text.Parsec.Pos as Parsec
4import qualified Text.PrettyPrint as P
8data Annotated annotation expr
14 = Span Position Position P.Doc
19data Position = Position
30none :: (Pretty expr) => expr -> Located expr
35noneNoDocs :: a -> Located a
44 -> Annotated Region expr
46 A (Span (position start) (position end) (pretty e)) e
49 Position (Parsec.sourceLine loc) (Parsec.sourceColumn loc)
52merge :: (Pretty expr) => Located a -> Located b -> expr -> Located expr
53merge (A s1 _) (A s2 _) e =
58 (Span start _ _, Span _ end _) ->
61 (Span start end _, _) ->
64 (_, Span start end _) ->
70mergeOldDocs :: Located a -> Located b -> c -> Located c
71mergeOldDocs (A s1 _) (A s2 _) e =
76 (Span start _ d1, Span _ end d2) ->
77 Span start end (P.vcat [d1, P.text "\n", d2])
83 (_, _) -> None P.empty
86sameAs :: Annotated a expr -> expr' -> Annotated a expr'
87sameAs (A annotation _) expr =
91getRegionDocs :: Region -> P.Doc
98instance Pretty Region where
104 case line start == line end of
105 False -> "between lines " ++ show (line start) ++ " and " ++ show (line end)
106 True -> "on line " ++ show (line end) ++ ", column " ++
107 show (column start) ++ " to " ++ show (column end)
110instance Pretty e => Pretty (Annotated a e) where
111 pretty (A _ e) = pretty e
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list