Safe Haskell | None |
---|---|
Language | Haskell2010 |
- class Semigroup a => InverseSemigroup a where
- data Error
- data Partial a
- total :: Partial a -> a
- class Composable a where
- class (Inverse (Idempotent a), Composable a, Idempotent (Idempotent a) ~ Idempotent a) => Inverse a where
- type Idempotent a :: *
- chunky :: Foldable f => f Text -> Text
- foldMapWithPos :: forall a m. (Measured a, Monoid m) => (Measure a -> a -> m) -> FingerTree a -> m
- class (Measured t, HasDelta (Measure t)) => Splittable t where
- consText :: Text -> FingerTree Text -> FingerTree Text
- snocText :: FingerTree Text -> Text -> FingerTree Text
- class Strippable a where
- class PP a where
- ppBar :: (String, String)
- pad :: Delta -> Char -> String
- pretty :: PP a => a -> IO ()
- data Grade = Grade !Delta !Delta
- data Edit = Edit !Delta !Delta !Delta
- inverseEdit :: Edit -> Edit
- class Editable a where
- class FromEdit a where
- ins :: FromEdit a => Delta -> a
- del :: FromEdit a => Delta -> a
- cpy :: FromEdit a => Delta -> a
- data Change = Change !(FingerTree Edit) !Delta
- changePattern :: Change -> (FingerTree Edit, Delta)
- pattern C0 :: Delta -> Change
- pattern CN :: Edit -> FingerTree Edit -> Delta -> Change
- newtype App f a = App {
- runApp :: f a
- class Changeable a where
- generalize :: Change -> Change
Documentation
class Semigroup a => InverseSemigroup a where Source #
a <> inv a <> a = a inv a <> a <> inv a = inv a
and all idempotents commute and are of the form (a <> inv a)
for some a
Inverse a => InverseSemigroup (Partial a) Source # | |
This occupies an uncomfortable middle ground between Maybe and Either
Monad Partial Source # | |
Functor Partial Source # | |
MonadFail Partial Source # | |
Applicative Partial Source # | |
Foldable Partial Source # | |
Traversable Partial Source # | |
Alternative Partial Source # | |
MonadPlus Partial Source # | |
Eq a => Eq (Partial a) Source # | |
Ord a => Ord (Partial a) Source # | |
Read a => Read (Partial a) Source # | |
Show a => Show (Partial a) Source # | |
Composable a => Semigroup (Partial a) Source # | |
Composable a => SemigroupWithZero (Partial a) Source # | |
Inverse a => InverseSemigroup (Partial a) Source # | |
class Composable a where Source #
Composable Delta Source # | |
Composable Change Source # |
|
Composable Grade Source # | |
class (Inverse (Idempotent a), Composable a, Idempotent (Idempotent a) ~ Idempotent a) => Inverse a where Source #
type Idempotent a :: * Source #
Inverse gives us an inverse category, but the types
aren't parameters and are down here at the value level
src
and tgt
are the source and target mappings, and ident
provides us the identity arrows.
src :: a -> Idempotent a Source #
src :: Idempotent a ~ a => a -> Idempotent a Source #
tgt :: a -> Idempotent a Source #
tgt :: Idempotent a ~ a => a -> Idempotent a Source #
idd :: Idempotent a -> a Source #
idd :: Idempotent a ~ a => Idempotent a -> a Source #
foldMapWithPos :: forall a m. (Measured a, Monoid m) => (Measure a -> a -> m) -> FingerTree a -> m Source #
class (Measured t, HasDelta (Measure t)) => Splittable t where Source #
Splittable Text Source # | |
Splittable Delta Source # | |
Splittable Change Source # | c = case splitChange d c of (l, r) -> l <> r grade c = case splitChange d c of (l, r) -> grade l + grade r delta (fst $ splitChange d c) = max 0 (min d (grade c)) delta (snd $ splitChange d c) = max 0 (min d (grade c - d)) O(log n) |
Splittable Edit Source # | |
Splittable a => Splittable (FingerTree a) Source # | |
consText :: Text -> FingerTree Text -> FingerTree Text Source #
snocText :: FingerTree Text -> Text -> FingerTree Text Source #
class Strippable a where Source #
stripSuffixes :: FingerTree Text -> a -> Partial a Source #
inverseEdit :: Edit -> Edit Source #
class Editable a where Source #
edit e >=> edit (inverseEdit e) >=> edit e = edit e edit (inverseEdit e) >=> edit e >=> edit (inverseEdit e) = edit (inverseEdit e)
Invariants:
1) no two edits with 0 spaces between them. they get coalesced into a single edit node
2) all edits have at least one of the finger-trees non-empty
Changes are simplicial morphisms, monotone functions between finite sets of integers that start at 0
Change !(FingerTree Edit) !Delta |
Eq Change Source # | |
Ord Change Source # | |
Show Change Source # | |
Semigroup Change Source # | given a change x that will successfully apply to t, and a change y that successfully applies to s concatChange x y successfully applies to (t <> s) |
Monoid Change Source # | |
Relative Change Source # | |
Measured Change Source # | |
HasDelta Change Source # | This measures the size of the domain, |
Changeable Change Source # |
|
FromEdit Change Source # | |
Editable Change Source # | |
PP Change Source # | |
Splittable Change Source # | c = case splitChange d c of (l, r) -> l <> r grade c = case splitChange d c of (l, r) -> grade l + grade r delta (fst $ splitChange d c) = max 0 (min d (grade c)) delta (snd $ splitChange d c) = max 0 (min d (grade c - d)) O(log n) |
Inverse Change Source # | |
Composable Change Source # |
|
type Measure Change Source # | |
type Idempotent Change Source # | |
changePattern :: Change -> (FingerTree Edit, Delta) Source #
class Changeable a where Source #
Changeable Delta Source # | O(log(min(k,n-k))) where there are |
Changeable Change Source # |
|
generalize :: Change -> Change Source #
build a strictly more general function that produces the same answer on all accepted inputs.
generalize is idempotent