Safe Haskell | None |
---|---|
Language | Haskell98 |
- data Action
- newtype TextOperation = TextOperation [Action]
- invertOperation :: TextOperation -> Text -> Either String TextOperation
Simple text operations
An action changes the text at the current position or advances the cursor.
newtype TextOperation Source
An edit on plain text documents. An operation consists of multiple actions that change the document at the current cursor position or advance the cursor. After applying all actions, the cursor must be at the end of the document.
:: TextOperation | An operation |
-> Text | Document to apply the operation to |
-> Either String TextOperation |
Computes the inverse of an operation. Useful for implementing undo.