File: LocationString.hs

package info (click to toggle)
haskell-file-location 0.4.9.1-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 112 kB
  • sloc: haskell: 282; ansic: 13; makefile: 2; sh: 1
file content (12 lines) | stat: -rw-r--r-- 450 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
module FileLocation.LocationString (locationToString) where

import Language.Haskell.TH.Syntax

-- turn the TH Loc loaction information into a human readable string
-- leaving out the loc_end parameter
locationToString :: Loc -> String
locationToString loc = (loc_package loc) ++ ':' : (loc_module loc) ++ 
  ' ' : (loc_filename loc) ++ ':' : (line loc) ++ ':' : (char loc)
  where
    line = show . fst . loc_start
    char = show . snd . loc_start