-- 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.2.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. -- -- -- -- 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] -- | 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 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