@@ -27,7 +27,7 @@ import Language.PureScript.Ide.Types (Ide, IdeConfiguration(..), IdeEnvironment(
2727import Language.PureScript.Ide.Util (ideReadFile )
2828import System.Directory (getCurrentDirectory )
2929import Database.SQLite.Simple qualified as SQLite
30- import System.FilePath ((</>) )
30+ import System.FilePath ((</>) , makeRelative )
3131import Data.Aeson (decode )
3232import Language.PureScript.Externs (ExternsFile (ExternsFile ))
3333import Data.ByteString qualified as T
@@ -38,7 +38,6 @@ import Unsafe.Coerce (unsafeCoerce)
3838import Database.SQLite.Simple (Query (fromQuery ), ToRow , SQLData (SQLText ))
3939import Data.String (String )
4040import Codec.Serialise (deserialise )
41- import System.FilePath (makeRelative )
4241
4342-- | Given a filepath performs the following steps:
4443--
@@ -248,34 +247,34 @@ sortExterns'
248247 => FilePath
249248 -> P. Module
250249 -> m [P. ExternsFile ]
251- sortExterns' _ m = do
250+ sortExterns' _ m = do
252251 let P. Module _ _ _ declarations _ = m
253252 let moduleDependencies = declarations >>= \ case
254253 P. ImportDeclaration _ importName _ _ -> [importName]
255254 _ -> []
256255
257256 externs <- runQuery $ unlines [
258257 " with recursive" ,
259- " graph(dependency, level) as (" ,
258+ " graph(dependency, level) as (" ,
260259 " select module_name , 1 as level" ,
261- " from modules where module_name in (" <> Data.Text. intercalate " , " (moduleDependencies <&> \ v -> " '" <> runModuleName v <> " '" ) <> " )" ,
260+ " from modules where module_name in (" <> Data.Text. intercalate " , " (moduleDependencies <&> \ v -> " '" <> runModuleName v <> " '" ) <> " )" ,
262261 " union " ,
263- " select d.dependency as dep, graph.level + 1 as level" ,
264- " from graph join dependencies d on graph.dependency = d.module_name" ,
262+ " select d.dependency as dep, graph.level + 1 as level" ,
263+ " from graph join dependencies d on graph.dependency = d.module_name" ,
265264 " )," ,
266- " topo as (" ,
267- " select dependency, max(level) as level" ,
268- " from graph group by dependency" ,
269- " ) " ,
265+ " topo as (" ,
266+ " select dependency, max(level) as level" ,
267+ " from graph group by dependency" ,
268+ " ) " ,
270269 " select extern" ,
271270 " from topo join modules on topo.dependency = modules.module_name order by level desc;"
272271 ]
273272
274- pure $ (externs >>= identity) <&> deserialise
273+ pure $ (externs >>= identity) <&> deserialise
275274
276- -- !r <- SQLite.withConnection (outputDir </> "cache.db") \conn ->
275+ -- !r <- SQLite.withConnection (outputDir </> "cache.db") \conn ->
277276 -- SQLite.query conn query (SQLite.Only $ "[" <> Data.Text.intercalate ", " (dependencies <&> \v -> "\"" <> runModuleName v <> "\"") <> "]")
278- -- <&> \r -> (r >>= identity) <&> deserialise
277+ -- <&> \r -> (r >>= identity) <&> deserialise
279278 -- pure r
280279
281280-- | Removes a modules export list.
0 commit comments