72 lines · 1.4 KB · Text
RawDownload
module Core.FC public exportFilePos : TypeFilePos = (Int, Int) showPos : FilePos -> StringshowPos (l, c) = show (l + 1) ++ ":" ++ show (c + 1) public exportFileName : TypeFileName = String ||| A file context is a filename together with starting and ending positionspublic exportdata FC = MkFC FileName FilePos FilePos        | EmptyFC exportEq FC where  (==) (MkFC n s e) (MkFC n' s' e') = n == n' && s == s' && e == e'  (==) EmptyFC EmptyFC = True  (==) _ _ = False exportfile : FC -> FileNamefile (MkFC fn _ _) = fnfile EmptyFC = "" exportstartPos : FC -> FilePosstartPos (MkFC _ s _) = sstartPos EmptyFC = (0, 0) exportendPos : FC -> FilePosendPos (MkFC _ _ e) = eendPos EmptyFC = (0, 0) -- Return whether a given file position is within the file context (assuming we're-- in the right file)exportwithin : FilePos -> FC -> Boolwithin (x, y) (MkFC _ start end)   = (x, y) >= start && (x, y) <= endwithin _ _ = False -- Return whether a given line is on the same line as the file context (assuming-- we're in the right file)exportonLine : Int -> FC -> BoolonLine x (MkFC _ start end)   = x >= fst start && x <= fst endonLine _ _ = False exportemptyFC : FCemptyFC = EmptyFC exporttoplevelFC : FCtoplevelFC = MkFC "(toplevel)" (0, 0) (0, 0) %name FC fc exportShow FC where  show loc = file loc ++ ":" ++             showPos (startPos loc) ++ "--" ++             showPos (endPos loc)  

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t