@@ -66,12 +66,12 @@ getImportsParsed dflags (L loc parsed) = do
66-- | locate a module in the file system. Where we go from *daml to Haskell
66-- | locate a module in the file system. Where we go from *daml to Haskell
67locateModuleFile :: MonadIO m
67locateModuleFile :: MonadIO m
68 => DynFlags
68 => DynFlags
69 -> (FilePath -> m Bool)
70 -> (FilePath -> m Bool)
70 -> ModuleName
71 -> ModuleName
71 -> m (Maybe FilePath)
72 -> m (Maybe FilePath)
72−locateModuleFile dflags doesExist modName = do
73+locateModuleFile dflags exts doesExist modName = do
73− let libPaths = importPaths dflags
74− let candidates = [ prefix </> M.moduleNameSlashes modName <.> "daml" | prefix <- libPaths ]
74+ let candidates = [ prefix </> M.moduleNameSlashes modName <.> ext | prefix <- importPaths dflags, ext <- exts]
75 findM doesExist candidates
75 findM doesExist candidates
77-- | locate a module in either the file system or the package database. Where we go from *daml to
77-- | locate a module in either the file system or the package database. Where we go from *daml to
@@ -79,18 +79,19 @@ locateModuleFile dflags doesExist modName = do
79locateModule
79locateModule
80 :: MonadIO m
80 :: MonadIO m
81 => DynFlags
81 => DynFlags
82 -> (FilePath -> m Bool)
83 -> (FilePath -> m Bool)
83 -> Located ModuleName
84 -> Located ModuleName
84 -> Maybe FastString
85 -> Maybe FastString
85 -> m (Either [FileDiagnostic] Import)
86 -> m (Either [FileDiagnostic] Import)
86−locateModule dflags doesExist modName mbPkgName = do
87+locateModule dflags exts doesExist modName mbPkgName = do
87 case mbPkgName of
88 case mbPkgName of
88 -- if a package name is given we only go look for a package
89 -- if a package name is given we only go look for a package
89 Just _pkgName -> lookupInPackageDB dflags
90 Just _pkgName -> lookupInPackageDB dflags
90 Nothing -> do
91 Nothing -> do
91 -- first try to find the module as a file. If we can't find it try to find it in the package
92 -- first try to find the module as a file. If we can't find it try to find it in the package
92 -- database.
93 -- database.
93− mbFile <- locateModuleFile dflags doesExist $ unLoc modName
94+ mbFile <- locateModuleFile dflags exts doesExist $ unLoc modName
94 case mbFile of
95 case mbFile of
95 Nothing -> lookupInPackageDB dflags
96 Nothing -> lookupInPackageDB dflags
96 Just file -> return $ Right $ FileImport file
97 Just file -> return $ Right $ FileImport file