mirror of
https://github.com/github/semantic.git
synced 2024-12-01 17:59:10 +03:00
Define a typeclass for joining constraints together.
This commit is contained in:
parent
a888d6722e
commit
052c99ec12
@ -1,4 +1,4 @@
|
|||||||
{-# LANGUAGE GADTs, ConstraintKinds, LambdaCase, RankNTypes, UndecidableInstances #-}
|
{-# LANGUAGE GADTs, ConstraintKinds, LambdaCase, KindSignatures, RankNTypes, TypeOperators, UndecidableInstances, UndecidableSuperClasses #-}
|
||||||
module Semantic.Api.Diffs
|
module Semantic.Api.Diffs
|
||||||
( parseDiffBuilder
|
( parseDiffBuilder
|
||||||
, DiffOutputFormat(..)
|
, DiffOutputFormat(..)
|
||||||
@ -26,6 +26,7 @@ import Data.Blob
|
|||||||
import Data.ByteString.Builder
|
import Data.ByteString.Builder
|
||||||
import Data.Graph
|
import Data.Graph
|
||||||
import Data.JSON.Fields
|
import Data.JSON.Fields
|
||||||
|
import Data.Kind (Constraint)
|
||||||
import Data.Language
|
import Data.Language
|
||||||
import Data.Term
|
import Data.Term
|
||||||
import qualified Data.Text as T
|
import qualified Data.Text as T
|
||||||
@ -188,6 +189,12 @@ doDiff decorate render blobPair = do
|
|||||||
diff <- diffTerms blobPair terms
|
diff <- diffTerms blobPair terms
|
||||||
render diff
|
render diff
|
||||||
|
|
||||||
|
class (c1 term, c2 term) => ((c1 :: (* -> *) -> Constraint) & (c2 :: (* -> *) -> Constraint)) (term :: * -> *)
|
||||||
|
|
||||||
|
infixl 9 &
|
||||||
|
|
||||||
|
instance (c1 term, c2 term) => (c1 & c2) term
|
||||||
|
|
||||||
diffTerms :: (DiffTerms term, Member Telemetry sig, Carrier sig m, MonadIO m)
|
diffTerms :: (DiffTerms term, Member Telemetry sig, Carrier sig m, MonadIO m)
|
||||||
=> BlobPair -> Join These (term ann) -> m (DiffFor term ann ann)
|
=> BlobPair -> Join These (term ann) -> m (DiffFor term ann ann)
|
||||||
diffTerms blobs terms = time "diff" languageTag $ do
|
diffTerms blobs terms = time "diff" languageTag $ do
|
||||||
|
Loading…
Reference in New Issue
Block a user