mirror of
https://github.com/github/semantic.git
synced 2025-01-05 14:11:33 +03:00
Move Source declarations to the top
This commit is contained in:
parent
ce3857320f
commit
8fffee031a
@ -8,6 +8,15 @@ import qualified Data.Vector as Vector
|
||||
import Numeric
|
||||
import Range
|
||||
|
||||
-- | The source, oid, path, and Maybe SourceKind of a blob in a Git repo.
|
||||
data SourceBlob = SourceBlob { source :: Source Char, oid :: String, path :: FilePath, blobKind :: Maybe SourceKind }
|
||||
deriving (Show, Eq)
|
||||
|
||||
-- | The contents of a source file, backed by a vector for efficient slicing.
|
||||
newtype Source a = Source { getVector :: Vector.Vector a }
|
||||
deriving (Eq, Show, Foldable, Functor, Traversable)
|
||||
|
||||
-- | The kind of a blob, along with it's file mode.
|
||||
data SourceKind = PlainBlob Word32 | ExecutableBlob Word32 | SymlinkBlob Word32
|
||||
deriving (Show, Eq)
|
||||
|
||||
@ -16,17 +25,11 @@ modeToDigits (PlainBlob mode) = showOct mode ""
|
||||
modeToDigits (ExecutableBlob mode) = showOct mode ""
|
||||
modeToDigits (SymlinkBlob mode) = showOct mode ""
|
||||
|
||||
data SourceBlob = SourceBlob { source :: Source Char, oid :: String, path :: FilePath, blobKind :: Maybe SourceKind }
|
||||
deriving (Show, Eq)
|
||||
|
||||
-- | The default plain blob mode
|
||||
defaultPlainBlob :: SourceKind
|
||||
defaultPlainBlob = PlainBlob 0o100644
|
||||
|
||||
-- | The contents of a source file, backed by a vector for efficient slicing.
|
||||
newtype Source a = Source { getVector :: Vector.Vector a }
|
||||
deriving (Eq, Show, Foldable, Functor, Traversable)
|
||||
|
||||
|
||||
-- | Map blobs with Nothing blobKind to empty blobs.
|
||||
idOrEmptySourceBlob :: SourceBlob -> SourceBlob
|
||||
|
Loading…
Reference in New Issue
Block a user