File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ Library
36
36
Build-Depends :
37
37
base >= 4.12 && < 5 ,
38
38
dhall >= 1.39.0 && < 1.43 ,
39
+ filepath < 1.6 ,
39
40
tomland >= 1.3.2.0 && < 1.4 ,
40
41
text >= 0.11.1.0 && < 2.2 ,
41
42
containers >= 0.5.9 && < 0.8 ,
Original file line number Diff line number Diff line change @@ -10,13 +10,15 @@ module Dhall.Toml.Utils
10
10
11
11
import Data.Text (Text )
12
12
import Data.Void (Void )
13
+ import Dhall.Import (SemanticCacheMode (.. ))
13
14
import Dhall.Parser (Src )
14
15
15
16
import qualified Data.Text.IO as Text.IO
16
17
import qualified Dhall.Core as Core
17
18
import qualified Dhall.Import
18
19
import qualified Dhall.Parser
19
20
import qualified Dhall.TypeCheck
21
+ import qualified System.FilePath as FilePath
20
22
21
23
-- | Read the file fileName and return the normalized Dhall AST
22
24
fileToDhall :: String -> IO (Core. Expr Src Void )
@@ -35,9 +37,15 @@ inputToDhall = do
35
37
-- by the parser for generating error messages.
36
38
textToDhall :: String -> Text -> IO (Core. Expr Src Void )
37
39
textToDhall fileName text = do
38
- parsedExpression <-
40
+ parsedExpression <- do
39
41
Core. throws (Dhall.Parser. exprFromText fileName text)
40
- resolvedExpression <- Dhall.Import. load parsedExpression
42
+
43
+ let directory = FilePath. takeDirectory fileName
44
+
45
+ resolvedExpression <- do
46
+ Dhall.Import. loadRelativeTo directory UseSemanticCache parsedExpression
47
+
41
48
_ <- Core. throws (Dhall.TypeCheck. typeOf resolvedExpression)
49
+
42
50
return resolvedExpression
43
51
You can’t perform that action at this time.
0 commit comments