1{-# LANGUAGE DeriveDataTypeable #-}
2module SourceSyntax.Location where
7data SrcPos = Pos Int Int
8 deriving (Eq, Ord, Data, Typeable)
10data SrcSpan = Span SrcPos SrcPos | NoSpan
11 deriving (Eq, Ord, Data, Typeable)
13data Located e = L (Maybe String) SrcSpan e deriving (Eq,Ord, Data, Typeable)
16instance Show SrcPos where
17 show (Pos r c) = "Line " ++ show r ++ ", Column " ++ show c
19instance Show SrcSpan where
22 Span start end -> show start
25instance Show e => Show (Located e) where
26 show (L _ _ e) = show e
30none = L Nothing NoSpan
32at start end = L Nothing
33 (Span (Pos (sourceLine start) (sourceColumn start))
34 (Pos (sourceLine end ) (sourceColumn end )))
36merge (L _ s1 _) (L _ s2 _) = L Nothing span
37 where span = case (s1,s2) of
38 (Span start _, Span _ end) -> Span start end
42add x (L Nothing span e) = L (Just (show x)) span e
43add x (L txt span e) = L txt span 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