summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCsaba Hruska <csaba.hruska@gmail.com>2018-02-03 11:26:52 +0100
committerCsaba Hruska <csaba.hruska@gmail.com>2018-02-03 11:26:52 +0100
commit61b9e74f5f14ee0af3eebb84764cbc93f119b730 (patch)
treeb5c7618a8000d75dc08968cec4d77342b631d621
parentae22b13a56c14af5274679ac1640e6a70d8a95b9 (diff)
better hide for prelude path
-rw-r--r--src/LambdaCube/Compiler/DesugaredSource.hs12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/LambdaCube/Compiler/DesugaredSource.hs b/src/LambdaCube/Compiler/DesugaredSource.hs
index 2e967eff..ae2899bc 100644
--- a/src/LambdaCube/Compiler/DesugaredSource.hs
+++ b/src/LambdaCube/Compiler/DesugaredSource.hs
@@ -21,6 +21,7 @@ import qualified Data.ByteString.Char8 as BS
21 21
22import Data.Binary 22import Data.Binary
23import GHC.Generics (Generic) 23import GHC.Generics (Generic)
24import qualified System.FilePath.Posix as FilePath
24 25
25--import Data.Text (Text) 26--import Data.Text (Text)
26import Data.Monoid 27import Data.Monoid
@@ -36,6 +37,8 @@ import LambdaCube.Compiler.Utils
36import LambdaCube.Compiler.DeBruijn 37import LambdaCube.Compiler.DeBruijn
37import LambdaCube.Compiler.Pretty --hiding (braces, parens) 38import LambdaCube.Compiler.Pretty --hiding (braces, parens)
38 39
40import Paths_lambdacube_compiler (getDataDir)
41
39-------------------------------------------------------------------------------- simple name 42-------------------------------------------------------------------------------- simple name
40 43
41-- TODO: move to Text 44-- TODO: move to Text
@@ -99,7 +102,14 @@ fileContent fi = unsafePerformIO $ do
99instance Eq FileInfo where (==) = (==) `on` fileId 102instance Eq FileInfo where (==) = (==) `on` fileId
100instance Ord FileInfo where compare = compare `on` fileId 103instance Ord FileInfo where compare = compare `on` fileId
101 104
102instance PShow FileInfo where pShow = text . filePath --(++ ".lc") . fileModule 105instance PShow FileInfo where
106 pShow fi = let path = filePath fi
107 in text $ if isPrefixOf lcPreludePath path
108 then "<<installed-prelude-path>>" ++ drop (length lcPreludePath) path
109 else path
110
111lcPreludePath :: String
112lcPreludePath = unsafePerformIO $ (FilePath.</> "lc") <$> getDataDir
103 113
104showPos :: FileInfo -> SPos -> Doc 114showPos :: FileInfo -> SPos -> Doc
105showPos n p = pShow n <> ":" <> pShow p 115showPos n p = pShow n <> ":" <> pShow p