-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Please see the README on GitHub at
-- https://github.com/codedownio/myers-diff#readme
@package myers-diff
@version 0.3.0.0
module Data.Diff.Types
data Edit
EditDelete :: Int -> Int -> Edit
[deleteFrom] :: Edit -> Int
[deleteTo] :: Edit -> Int
EditInsert :: Int -> Int -> Int -> Edit
[insertPos] :: Edit -> Int
[insertFrom] :: Edit -> Int
[insertTo] :: Edit -> Int
data Position
Position :: Int -> Int -> Position
[positionLine] :: Position -> Int
[positionCh] :: Position -> Int
data Range
Range :: Position -> Position -> Range
[rangeStart] :: Range -> Position
[rangeEnd] :: Range -> Position
data ChangeEvent
ChangeEvent :: Range -> Text -> ChangeEvent
[range] :: ChangeEvent -> Range
[text] :: ChangeEvent -> Text
instance GHC.Classes.Eq Data.Diff.Types.Edit
instance GHC.Show.Show Data.Diff.Types.Edit
instance GHC.Classes.Eq Data.Diff.Types.Position
instance GHC.Show.Show Data.Diff.Types.Position
instance GHC.Classes.Eq Data.Diff.Types.Range
instance GHC.Show.Show Data.Diff.Types.Range
instance GHC.Classes.Eq Data.Diff.Types.ChangeEvent
instance GHC.Show.Show Data.Diff.Types.ChangeEvent
-- | This is a fast Haskell implementation of the Myers text diff
-- algorithm[1]. It is heavily inspired by the Python version in this
-- post, and should have the same O(min(len(a), len(b)))
-- space complexity. (By contrast, the Diff package advertises
-- O(ab) space complexity.) The implementation uses unboxed
-- mutable vectors for performance.
--
-- This repo also can also build a couple other versions for benchmarking
-- comparison, gated behind flags.
--
--
-- - -funi_myers will build the version from the
-- uni-util package.
-- - -fdiff_myers will use the Diff package.
--
--
--
-- - 1 E. Myers (1986). "An O(ND) Difference Algorithm and Its
-- Variations". Algorithmica. 1 (2): 251–266. CiteSeerX
-- 10.1.1.4.6927.
-- doi:[10.1007BF01840446](https:doi.org10.1007%2FBF01840446).
-- S2CID 6996809.
--
module Data.Diff.Myers
-- | Diff Texts to produce an edit script.
diffTexts :: Text -> Text -> Seq Edit
-- | Diff Texts to produce LSP-style change events.
diffTextsToChangeEvents :: Text -> Text -> [ChangeEvent]
-- | Diff Texts to produce consolidated LSP-style change events.
diffTextsToChangeEventsConsolidate :: Text -> Text -> [ChangeEvent]
-- | Diff Texts with a custom consolidation function.
diffTextsToChangeEvents' :: (Seq Edit -> Seq Edit) -> Text -> Text -> [ChangeEvent]
-- | Diff Vectors to produce an edit script.
diffVectors :: Vector Char -> Vector Char -> Seq Edit
-- | To use in benchmarking against other libraries that use String.
diffStrings :: String -> String -> Seq Edit
diff :: (PrimMonad m, Unbox a, Eq a, Show a) => Vector a -> Vector a -> m (Seq Edit)
-- | Convert edit script to LSP-style change events.
editScriptToChangeEvents :: Vector Char -> Vector Char -> Seq Edit -> Seq ChangeEvent
-- | Consolidate adjacent edit script entries to shorten the script.
consolidateEditScript :: Seq Edit -> Seq Edit
-- | This is currently the only way to convert a Text to a
-- Vector without extraneous allocations. Taken from
-- https://stackoverflow.com/a/77388392/2659595 Once the text
-- library contains a foldM function, we can switch to that and avoid
-- importing internal functions. See
-- https://github.com/haskell/text/pull/543
fastTextToVector :: Text -> Vector Char
data Edit
EditDelete :: Int -> Int -> Edit
[deleteFrom] :: Edit -> Int
[deleteTo] :: Edit -> Int
EditInsert :: Int -> Int -> Int -> Edit
[insertPos] :: Edit -> Int
[insertFrom] :: Edit -> Int
[insertTo] :: Edit -> Int