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
14 deriving (Eq, Ord, Data, Typeable)
17instance Show SrcPos where
18 show (Pos r c) = "Line " ++ show r ++ ", Column " ++ show c
20instance Show SrcSpan where
23 Span start end -> show start
26instance Show e => Show (Located e) where
27 show (L _ _ e) = show e
31none = L Nothing NoSpan
33at start end = L Nothing
34 (Span (Pos (sourceLine start) (sourceColumn start))
35 (Pos (sourceLine end ) (sourceColumn end )))
37merge (L _ s1 _) (L _ s2 _) = L Nothing span
38 where span = case (s1,s2) of
39 (Span start _, Span _ end) -> Span start end
43add x (L Nothing span e) = L (Just (show x)) span e
44add 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