@@ -4,30 +4,29 @@ module Agda.Interaction.Imports.More
44 ( setOptionsFromSourcePragmas ,
55 checkModuleName' ,
66 runPMDropWarnings ,
7+ srcFilePath ,
78 moduleName ,
89 runPM ,
910 beginningOfFile ,
1011 )
1112where
1213
1314import Agda.Interaction.FindFile (
14- SourceFile (SourceFile ),
1515 checkModuleName ,
1616#if MIN_VERSION_Agda(2,8,0)
17+ SourceFile ,
1718 rootNameModule ,
1819#else
20+ SourceFile (SourceFile ),
1921 moduleName ,
2022#endif
2123 )
22- import Agda.Interaction.Imports (Source (.. ))
2324import qualified Agda.Interaction.Imports as Imp
2425import Agda.Interaction.Library (OptionsPragma (.. ), _libPragmas )
2526import Agda.Interaction.Library.More ()
2627import Agda.Syntax.Common (TopLevelModuleName' )
2728import qualified Agda.Syntax.Concrete as C
2829import Agda.Syntax.Parser (
29- moduleParser ,
30- parseFile ,
3130#if MIN_VERSION_Agda(2,8,0)
3231 parse ,
3332 moduleNameParser ,
@@ -38,35 +37,28 @@ import Agda.Syntax.Parser (
3837 )
3938import Agda.Syntax.Position
4039 ( Range ,
41- Range' (Range ),
42- RangeFile ,
4340 getRange ,
44- intervalToRange ,
45- mkRangeFile ,
46- posToRange ,
47- posToRange' ,
48- startPos ,
4941#if MIN_VERSION_Agda(2,8,0)
5042 beginningOfFile ,
5143 rangeFromAbsolutePath ,
44+ #else
45+ RangeFile ,
46+ posToRange ,
47+ startPos ,
5248#endif
5349 )
50+ #if MIN_VERSION_Agda(2,8,0)
5451import Agda.Syntax.TopLevelModuleName (
5552 TopLevelModuleName ,
5653 RawTopLevelModuleName (.. ),
57- #if MIN_VERSION_Agda(2,8,0)
5854 rawTopLevelModuleNameForModule ,
59- #endif
6055 )
61- import Agda.Syntax.Common.Pretty (Pretty , pretty , text , prettyAssign , (<+>) )
56+ #endif
57+ import Agda.Syntax.Common.Pretty (Pretty , pretty , text , (<+>) )
6258import Agda.TypeChecking.Monad
63- ( Interface ,
64- TCM ,
59+ ( TCM ,
6560 setCurrentRange ,
6661 setOptionsFromPragma ,
67- setTCLens ,
68- stPragmaOptions ,
69- useTC ,
7062#if MIN_VERSION_Agda(2,7,0)
7163 checkAndSetOptionsFromPragma ,
7264#endif
@@ -76,17 +68,15 @@ import Agda.TypeChecking.Monad
7668#endif
7769 )
7870import qualified Agda.TypeChecking.Monad as TCM
79- import qualified Agda.TypeChecking.Monad.Benchmark as Bench
8071#if MIN_VERSION_Agda(2,8,0)
72+ import qualified Agda.TypeChecking.Monad.Benchmark as Bench
8173#else
8274import Agda.TypeChecking.Warnings (runPM )
8375#endif
8476import Agda.Utils.FileName (AbsolutePath )
85- import Agda.Utils.Monad (bracket_ )
8677#if MIN_VERSION_Agda(2,8,0)
8778import qualified Data.Text as T
8879#endif
89- import qualified Data.Text.Lazy as TL
9080import Control.Monad.Error.Class (
9181#if MIN_VERSION_Agda(2,8,0)
9282 catchError ,
@@ -98,13 +88,6 @@ import Control.Monad.Error.Class (
9888import Agda.Utils.Singleton (singleton )
9989#endif
10090
101- srcFilePath :: SourceFile -> TCM AbsolutePath
102- #if MIN_VERSION_Agda(2,8,0)
103- srcFilePath = TCM. srcFilePath
104- #else
105- srcFilePath (SourceFile f) = return f
106- #endif
107-
10891#if MIN_VERSION_Agda(2,8,0)
10992-- beginningOfFile was generalized in Agda 2.8.0 to support the features we
11093-- need, so we just import it
@@ -124,6 +107,14 @@ runPMDropWarnings m = do
124107 Right a -> return a
125108#endif
126109
110+ #if MIN_VERSION_Agda(2,8,0)
111+ srcFilePath :: (TCM. MonadFileId m ) => SourceFile -> m AbsolutePath
112+ srcFilePath = TCM. srcFilePath
113+ #else
114+ srcFilePath :: (Monad m ) => SourceFile -> m AbsolutePath
115+ srcFilePath (SourceFile path) = return path
116+ #endif
117+
127118-- Unexported Agda functions
128119
129120srcDefaultPragmas :: Imp. Source -> [OptionsPragma ]
0 commit comments