mirror of
https://github.com/github/semantic.git
synced 2024-11-24 08:54:07 +03:00
Rename Data.Patch to Data.Edit.
This commit is contained in:
parent
6b7ef7c725
commit
7b37f3789f
@ -148,6 +148,7 @@ library
|
||||
, Data.Blob.IO
|
||||
, Data.Diff
|
||||
, Data.Duration
|
||||
, Data.Edit
|
||||
, Data.Error
|
||||
, Data.Flag
|
||||
, Data.Functor.Both
|
||||
@ -160,7 +161,6 @@ library
|
||||
, Data.JSON.Fields
|
||||
, Data.Language
|
||||
, Data.Map.Monoidal
|
||||
, Data.Patch
|
||||
, Data.Project
|
||||
, Data.Quieterm
|
||||
, Data.Semigroup.App
|
||||
|
@ -18,10 +18,10 @@ import Data.Aeson
|
||||
import Data.Bifoldable
|
||||
import Data.Bifunctor
|
||||
import Data.Bitraversable
|
||||
import Data.Edit
|
||||
import Data.Functor.Classes
|
||||
import Data.Functor.Foldable
|
||||
import Data.JSON.Fields
|
||||
import Data.Patch
|
||||
import Data.Term
|
||||
import Text.Show
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
{-# LANGUAGE LambdaCase #-}
|
||||
module Data.Patch
|
||||
module Data.Edit
|
||||
( Patch(..)
|
||||
, edit
|
||||
) where
|
@ -9,8 +9,8 @@ module Data.JSON.Fields
|
||||
) where
|
||||
|
||||
import Data.Aeson
|
||||
import Data.Edit
|
||||
import qualified Data.Map as Map
|
||||
import Data.Patch
|
||||
import Data.Sum (Apply (..), Sum)
|
||||
import qualified Data.Text as Text
|
||||
import GHC.Generics
|
||||
|
@ -14,8 +14,8 @@ import Control.Effect.Reader
|
||||
import Control.Effect.State
|
||||
import Control.Lens
|
||||
import Data.Diff
|
||||
import Data.Edit
|
||||
import Data.Graph
|
||||
import Data.Patch
|
||||
import Data.ProtoLens (defMessage)
|
||||
import Data.String (IsString (..))
|
||||
import Data.Term
|
||||
|
@ -15,9 +15,9 @@ module Rendering.JSON
|
||||
|
||||
import Data.Aeson (ToJSON, toJSON, object, (.=))
|
||||
import Data.Aeson as A
|
||||
import Data.JSON.Fields
|
||||
import Data.Blob
|
||||
import Data.Patch
|
||||
import Data.Edit
|
||||
import Data.JSON.Fields
|
||||
import Data.Text (pack)
|
||||
import GHC.TypeLits
|
||||
import Prologue
|
||||
|
@ -15,10 +15,10 @@ import Analysis.TOCSummary
|
||||
import Data.Align (bicrosswalk)
|
||||
import Data.Aeson (ToJSON(..), Value, (.=), object)
|
||||
import Data.Diff
|
||||
import Data.Edit
|
||||
import Data.Language as Language
|
||||
import Data.List (sortOn)
|
||||
import qualified Data.Map.Monoidal as Map
|
||||
import Data.Patch
|
||||
import Data.Term
|
||||
import qualified Data.Text as T
|
||||
import Source.Loc
|
||||
|
@ -8,7 +8,7 @@ module Serializing.SExpression
|
||||
import Analysis.ConstructorName
|
||||
import Data.ByteString.Builder
|
||||
import Data.Diff
|
||||
import Data.Patch
|
||||
import Data.Edit
|
||||
import Data.Term
|
||||
import Prelude
|
||||
import Prologue
|
||||
|
@ -20,10 +20,10 @@ import qualified Analysis.TOCSummary as ToC
|
||||
import Data.Abstract.ScopeGraph (AccessControl(..))
|
||||
import Data.Bifunctor.Join
|
||||
import Data.Diff
|
||||
import Data.Edit
|
||||
import Data.Functor.Both
|
||||
import qualified Data.Language as Language
|
||||
import Data.List.NonEmpty
|
||||
import Data.Patch
|
||||
import qualified Data.Syntax as Syntax
|
||||
import qualified Data.Syntax.Comment as Comment
|
||||
import qualified Data.Syntax.Declaration as Declaration
|
||||
|
@ -3,12 +3,12 @@ module Diffing.Interpreter.Spec (spec, afterTerm, beforeTerm) where
|
||||
|
||||
import Control.Applicative ((<|>))
|
||||
import Data.Diff
|
||||
import Data.Edit (edit)
|
||||
import Data.Foldable (asum)
|
||||
import Data.Functor.Foldable (cata)
|
||||
import Data.Functor.Listable
|
||||
import Data.Maybe
|
||||
import Data.Mergeable
|
||||
import Data.Patch (after, before)
|
||||
import Data.Sum
|
||||
import Data.Term
|
||||
import Data.These
|
||||
@ -81,5 +81,13 @@ afterTerm = cata $ \ diff -> case diff of
|
||||
Patch patch -> (after patch >>= \ (In b r) -> termIn b <$> sequenceAlt r) <|> (before patch >>= asum)
|
||||
Merge (In (_, b) r) -> termIn b <$> sequenceAlt r
|
||||
|
||||
-- | Return the item from the after side of the patch.
|
||||
after :: Patch l r -> Maybe r
|
||||
after = edit (const Nothing) Just (\ _ b -> Just b)
|
||||
|
||||
-- | Return the item from the before side of the patch.
|
||||
before :: Patch l r -> Maybe l
|
||||
before = edit Just (const Nothing) (\ a _ -> Just a)
|
||||
|
||||
emptyAnnotation :: ()
|
||||
emptyAnnotation = ()
|
||||
|
@ -7,8 +7,8 @@ import Control.Effect.Reader
|
||||
import Data.Aeson hiding (defaultOptions)
|
||||
import Data.Bifunctor
|
||||
import Data.Diff
|
||||
import Data.Edit
|
||||
import Data.Either (isRight)
|
||||
import Data.Patch
|
||||
import Data.Sum
|
||||
import Data.Term
|
||||
import Data.Text (Text)
|
||||
|
Loading…
Reference in New Issue
Block a user