1
1
mirror of https://github.com/github/semantic.git synced 2025-01-03 04:51:57 +03:00

Define a Listable instance for Source.

This commit is contained in:
Rob Rix 2017-02-13 11:55:20 -05:00
parent d18dfe453e
commit 329485febd

View File

@ -4,9 +4,11 @@ module Source where
import Prologue import Prologue
import qualified Data.Text as Text import qualified Data.Text as Text
import Data.Text.Listable
import Numeric import Numeric
import Range import Range
import SourceSpan import SourceSpan
import Test.LeanCheck
-- | The source, oid, path, and Maybe SourceKind of a blob in a Git repo. -- | The source, oid, path, and Maybe SourceKind of a blob in a Git repo.
data SourceBlob = SourceBlob { source :: Source, oid :: Text, path :: FilePath, blobKind :: Maybe SourceKind } data SourceBlob = SourceBlob { source :: Source, oid :: Text, path :: FilePath, blobKind :: Maybe SourceKind }
@ -118,3 +120,6 @@ instance Semigroup Source where
instance Monoid Source where instance Monoid Source where
mempty = fromList [] mempty = fromList []
mappend = (<>) mappend = (<>)
instance Listable Source where
tiers = (Source . unListableText) `mapT` tiers