1
1
mirror of https://github.com/github/semantic.git synced 2024-12-23 14:54:16 +03:00

Constrain & parametricize SExpressionDiffRenderer & SExpressionTermRenderer appropriately.

This commit is contained in:
Rob Rix 2017-03-31 16:14:44 -04:00
parent 92092f6136
commit 30ab7102bb

View File

@ -16,6 +16,7 @@ import Data.Functor.Listable
import Data.Record import Data.Record
import Info import Info
import Prologue import Prologue
import Renderer.SExpression
import Source (SourceBlob) import Source (SourceBlob)
import Syntax import Syntax
import Diff import Diff
@ -25,12 +26,12 @@ data DiffRenderer fields output where
PatchRenderer :: HasField fields Range => DiffRenderer fields Text PatchRenderer :: HasField fields Range => DiffRenderer fields Text
JSONDiffRenderer :: (ToJSON (Record fields), HasField fields Category, HasField fields Range) => DiffRenderer fields (Map Text Value) JSONDiffRenderer :: (ToJSON (Record fields), HasField fields Category, HasField fields Range) => DiffRenderer fields (Map Text Value)
SummaryRenderer :: DiffRenderer fields (Map Text (Map Text [Value])) SummaryRenderer :: DiffRenderer fields (Map Text (Map Text [Value]))
SExpressionDiffRenderer :: DiffRenderer fields ByteString SExpressionDiffRenderer :: (HasField fields Category, HasField fields SourceSpan) => SExpressionFormat -> DiffRenderer fields ByteString
ToCRenderer :: DiffRenderer fields (Map Text (Map Text [Value])) ToCRenderer :: DiffRenderer fields (Map Text (Map Text [Value]))
data TermRenderer a where data TermRenderer fields a where
JSONTermRenderer :: TermRenderer (Map Text Value) JSONTermRenderer :: TermRenderer fields (Map Text Value)
SExpressionTermRenderer :: TermRenderer ByteString SExpressionTermRenderer :: (HasField fields Category, HasField fields SourceSpan) => SExpressionFormat -> TermRenderer fields ByteString
-- | A function that will render a diff, given the two source blobs. -- | A function that will render a diff, given the two source blobs.
type Renderer annotation = Both SourceBlob -> Diff (Syntax Text) annotation -> Output type Renderer annotation = Both SourceBlob -> Diff (Syntax Text) annotation -> Output