diff --git a/src/Command/Files.hs b/src/Command/Files.hs index 58da6289c..46625b409 100644 --- a/src/Command/Files.hs +++ b/src/Command/Files.hs @@ -1,6 +1,7 @@ {-# LANGUAGE OverloadedStrings, TypeSynonymInstances, DeriveAnyClass, DuplicateRecordFields #-} module Command.Files -( readFile +( readBlobs +, readFile , readBlobPairsFromHandle , readBlobsFromHandle , languageForFilePath @@ -20,6 +21,10 @@ import qualified Data.ByteString.Lazy as BL import Prelude (fail) import System.FilePath +-- | Read a list of 'Blob.Blob's from either a 'Handle' or a list of 'FilePath's optionally paired with 'Language's. +readBlobs :: Either Handle [(FilePath, Maybe Language)] -> IO [Blob.Blob] +readBlobs = either readBlobsFromHandle (traverse (uncurry readFile)) + -- | Read a utf8-encoded file to a 'Blob'. readFile :: FilePath -> Maybe Language -> IO Blob.Blob