Skip to content

Commit

Permalink
use existing concatMapM
Browse files Browse the repository at this point in the history
  • Loading branch information
hexwell committed Jan 4, 2022
1 parent 5c487a7 commit 6a6894c
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions hs/Vflow.hs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import Control.Monad.Trans.Except (ExceptT, except, runExceptT)
import Data.Function ((&))
import Data.List (intercalate)
import GHC.Utils.Misc (split)
import GHC.Utils.Monad (concatMapM)
import System.Environment (getArgs)
import System.Info (os)
import Text.Parsec (ParseError, runParser)
Expand Down Expand Up @@ -37,12 +38,8 @@ parseBash filename = do
"linux" -> '/'
"mingw32" -> '\\'


many :: (Traversable t, Monad m) => (Filename -> ExceptT e m [a]) -> t Filename -> ExceptT e m [a]
many p = mapM p >>> fmap concat

parseRoot :: String -> Filename -> IO (Either ParseError [Block])
parseRoot l@"bash" rootFile = runExceptT $ allFiles >>= many (parseVflow l)
parseRoot l@"bash" rootFile = runExceptT $ allFiles >>= concatMapM (parseVflow l)
where
allFiles = (rootFile:) <$> parseBash rootFile

Expand Down

0 comments on commit 6a6894c

Please sign in to comment.