Skip to content

Commit

Permalink
Fix glob path order
Browse files Browse the repository at this point in the history
  • Loading branch information
fizruk committed Sep 19, 2023
1 parent 87ae80c commit 77b7cc0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions rzk/src/Rzk/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ module Rzk.Main where
import Control.Monad (forM)
import qualified Data.Aeson as JSON
import qualified Data.ByteString.Lazy.Char8 as ByteString
import Data.List (sort)
import Data.Version (showVersion)
import Options.Generic
import System.Exit (exitFailure)
Expand Down Expand Up @@ -58,7 +59,7 @@ globNonEmpty :: FilePath -> IO [FilePath]
globNonEmpty path = do
glob path >>= \case
[] -> error ("File(s) not found at " <> path)
paths -> return paths
paths -> return (sort paths)

parseRzkFilesOrStdin :: [FilePath] -> IO [(FilePath, Rzk.Module)]
parseRzkFilesOrStdin = \case
Expand All @@ -69,7 +70,7 @@ parseRzkFilesOrStdin = \case
-- otherwise — parse all given files in given order
paths -> do
expandedPaths <- foldMap globNonEmpty paths
forM (reverse expandedPaths) $ \path -> do
forM expandedPaths $ \path -> do
putStrLn ("Loading file " <> path)
result <- Rzk.parseModule <$> readFile path
case result of
Expand Down

0 comments on commit 77b7cc0

Please sign in to comment.