mirror of
https://github.com/github/semantic.git
synced 2024-12-21 05:41:54 +03:00
Define a high-level operation to read in blobs.
This commit is contained in:
parent
ab7b39e771
commit
90f4aa38a7
@ -1,6 +1,7 @@
|
|||||||
{-# LANGUAGE OverloadedStrings, TypeSynonymInstances, DeriveAnyClass, DuplicateRecordFields #-}
|
{-# LANGUAGE OverloadedStrings, TypeSynonymInstances, DeriveAnyClass, DuplicateRecordFields #-}
|
||||||
module Command.Files
|
module Command.Files
|
||||||
( readFile
|
( readBlobs
|
||||||
|
, readFile
|
||||||
, readBlobPairsFromHandle
|
, readBlobPairsFromHandle
|
||||||
, readBlobsFromHandle
|
, readBlobsFromHandle
|
||||||
, languageForFilePath
|
, languageForFilePath
|
||||||
@ -20,6 +21,10 @@ import qualified Data.ByteString.Lazy as BL
|
|||||||
import Prelude (fail)
|
import Prelude (fail)
|
||||||
import System.FilePath
|
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'.
|
-- | Read a utf8-encoded file to a 'Blob'.
|
||||||
readFile :: FilePath -> Maybe Language -> IO Blob.Blob
|
readFile :: FilePath -> Maybe Language -> IO Blob.Blob
|
||||||
|
Loading…
Reference in New Issue
Block a user