Safe Haskell | None |
---|---|
Language | Haskell98 |
Synopsis
- corrections :: [Note OutputMessage] -> [Note Refact]
- type CorrectorMatch = Note OutputMessage -> Maybe (Note Refact)
- correctors :: [CorrectorMatch]
- match :: String -> ((Int -> Maybe Text) -> Region -> Refact) -> CorrectorMatch
- findCorrector :: Note OutputMessage -> Maybe (Note Refact)
- class Monoid m => Group m where
- class Group g => Abelian g
- undo :: Editable s => Edit s -> s -> Edit s
- apply :: Editable s => Edit s -> s -> s
- overwrite :: EditAction e s => Point -> s -> e s
- paste :: EditAction e s => Point -> s -> e s
- cut :: EditAction e s => Region -> e s
- replace :: EditAction e s => Region -> s -> e s
- insertRegion :: Region -> Region -> Region
- cutRegion :: Region -> Region -> Region
- insertMap :: Region -> Map
- cutMap :: Region -> Map
- applyMap :: Map -> Region -> Region
- overlaps :: Region -> Region -> Bool
- atRegion :: Editable s => Region -> Lens' (Contents s) (Contents s)
- expandLines :: Region -> Region
- regionSize :: Point -> Size -> Region
- line :: Int -> Region
- emptyRegion :: Region -> Bool
- regionLines :: Lens' Region Int
- linesSize :: Int -> Size
- till :: Point -> Point -> Region
- regionLength :: Lens' Region Size
- lineStart :: Int -> Point
- start :: Point
- pt :: Int -> Int -> Point
- class Editable s => EditAction (e :: * -> *) s where
- replaces :: (Profunctor p, Functor f) => p [Replace s1] (f [Replace s2]) -> p (Edit s1) (f (Edit s2))
- class Regioned a where
- replaceWith :: Functor f => (Contents s1 -> f (Contents s2)) -> Replace s1 -> f (Replace s2)
- replaceRegion :: Functor f => (Region -> f Region) -> Replace s -> f (Replace s)
- newtype Edit s = Edit {}
- measure :: Editable s => Contents s -> Size
- by :: Editable a => a -> Contents a
- contents :: (Editable a, Editable b) => Iso a b (Contents a) (Contents b)
- splitted :: Editable a => Point -> Iso' (Contents a) (Contents a, Contents a)
- splitCts :: Editable a => Point -> Contents a -> (Contents a, Contents a)
- concatCts :: Monoid a => Contents a -> Contents a -> Contents a
- emptyContents :: Monoid a => Contents a
- regionTo :: Lens' Region Point
- regionFrom :: Lens' Region Point
- newtype Map = Map {}
- type Contents a = [a]
- class Monoid a => Editable a where
- data Replace s = Replace {
- _replaceRegion :: Region
- _replaceWith :: Contents s
- (.+.) :: Point -> Point -> Point
- (.-.) :: Point -> Point -> Point
- pointRegion :: Iso' Point Region
- pointLine :: Lens' Point Int
- pointColumn :: Lens' Point Int
- type Size = Point
- data Point = Point {
- _pointLine :: Int
- _pointColumn :: Int
- module HsDev.Tools.Refact
- module HsDev.Tools.Types
Documentation
corrections :: [Note OutputMessage] -> [Note Refact] Source #
type CorrectorMatch = Note OutputMessage -> Maybe (Note Refact) Source #
correctors :: [CorrectorMatch] Source #
findCorrector :: Note OutputMessage -> Maybe (Note Refact) Source #
class Monoid m => Group m where #
A Group
is a Monoid
plus a function, invert
, such that:
a <> invert a == mempty
invert a <> a == mempty
Instances
Group () | |
Group Map | |
Group Point | |
Group a => Group (Dual a) | |
Num a => Group (Sum a) | |
Fractional a => Group (Product a) | |
Group b => Group (a -> b) | |
(Group a, Group b) => Group (a, b) | |
(Group a, Group b, Group c) => Group (a, b, c) | |
(Group a, Group b, Group c, Group d) => Group (a, b, c, d) | |
(Group a, Group b, Group c, Group d, Group e) => Group (a, b, c, d, e) | |
Instances
Abelian () | |
Defined in Data.Group | |
Abelian a => Abelian (Dual a) | |
Defined in Data.Group | |
Num a => Abelian (Sum a) | |
Defined in Data.Group | |
Fractional a => Abelian (Product a) | |
Defined in Data.Group | |
Abelian b => Abelian (a -> b) | |
Defined in Data.Group | |
(Abelian a, Abelian b) => Abelian (a, b) | |
Defined in Data.Group | |
(Abelian a, Abelian b, Abelian c) => Abelian (a, b, c) | |
Defined in Data.Group | |
(Abelian a, Abelian b, Abelian c, Abelian d) => Abelian (a, b, c, d) | |
Defined in Data.Group | |
(Abelian a, Abelian b, Abelian c, Abelian d, Abelian e) => Abelian (a, b, c, d, e) | |
Defined in Data.Group |
cut :: EditAction e s => Region -> e s #
Cuts region
replace :: EditAction e s => Region -> s -> e s #
Replace region with data
insertRegion :: Region -> Region -> Region #
Update second region position as if it was data inserted at first region (region sets insertion point and data size) Region tries not to extend if data inserted at region bound except when region is empty This allows define replace as cut and insert in special case when we replace region itself
expandLines :: Region -> Region #
Expand Region
to contain full lines
emptyRegion :: Region -> Bool #
Is Region
empty
regionLines :: Lens' Region Int #
regionLength :: Lens' Region Size #
Regions length
class Editable s => EditAction (e :: * -> *) s where #
replaceAction :: Region -> Contents s -> e s #
Make Map
from action
perform :: e s -> Contents s -> Contents s #
Perform action, modifying Contents
inversed :: e s -> Contents s -> e s #
Get action undo
Instances
Editable s => EditAction Edit s | |
Editable s => EditAction Replace s | |
replaces :: (Profunctor p, Functor f) => p [Replace s1] (f [Replace s2]) -> p (Edit s1) (f (Edit s2)) #
regions :: Traversal' a Region #
Instances
Regioned Region | |
Defined in Data.Text.Region.Types | |
Regioned Point | |
Defined in Data.Text.Region.Types | |
Regioned Refact # | |
Defined in HsDev.Tools.Refact | |
Regioned (Edit s) | |
Defined in Data.Text.Region.Types regions :: Traversal' (Edit s) Region # | |
Regioned (Replace s) | |
Defined in Data.Text.Region.Types regions :: Traversal' (Replace s) Region # | |
Regioned a => Regioned (Note a) # | |
Defined in HsDev.Tools.AutoFix regions :: Traversal' (Note a) Region # |
Edit is several replace actions, applied simultaneously, must not overlap
Instances
Editable s => EditAction Edit s | |
Eq s => Eq (Edit s) | |
(Editable s, ToJSON s) => Show (Edit s) | |
Semigroup (Edit s) | |
Monoid (Edit s) | |
(Editable s, ToJSON s) => ToJSON (Edit s) | |
Defined in Data.Text.Region.Types | |
(Editable s, FromJSON s) => FromJSON (Edit s) | |
Regioned (Edit s) | |
Defined in Data.Text.Region.Types regions :: Traversal' (Edit s) Region # |
emptyContents :: Monoid a => Contents a #
Empty contents are contents with one empty line
regionFrom :: Lens' Region Point #
Main idea is that there are only two basic actions, that changes regions: inserting and cutting
When something is cutted out or inserted in, Region
positions must be updated
All editings can be represented as many cuts and inserts, so we can combine them to get function
which maps source regions to regions on updated data
Because insert is dual to cut (and therefore composes something like iso), we can also get function to map regions back
Combining this functions while edit, we get function, that maps regions from source data to edited one
To get back function, we must also combine opposite actions, or we can represent actions as Iso
Same idea goes for modifying contents, represent each action as isomorphism and combine them together
This works if we don't use overlapped regions
class Monoid a => Editable a where #
Something editable, string types implements this
splitContents :: Int -> a -> (a, a) #
Split editable at some position
contentsLength :: a -> Int #
splitLines :: a -> [a] #
Instances
Editable String | |
Defined in Data.Text.Region.Types | |
Editable Text | |
Defined in Data.Text.Region.Types |
Serializable edit action
Replace | |
|
Instances
Editable s => EditAction Replace s | |
Eq s => Eq (Replace s) | |
(Editable s, ToJSON s) => Show (Replace s) | |
(Editable s, ToJSON s) => ToJSON (Replace s) | |
Defined in Data.Text.Region.Types | |
(Editable s, FromJSON s) => FromJSON (Replace s) | |
Regioned (Replace s) | |
Defined in Data.Text.Region.Types regions :: Traversal' (Replace s) Region # |
(.-.) :: Point -> Point -> Point #
pt .-. base
is distance from base
to pt
Distance can't be less then zero lines and columns
pointRegion :: Iso' Point Region #
As empty region
pointColumn :: Lens' Point Int #
Distance between Point
s is measured in lines and columns.
And it is defined, that distance between point at l:c and point (l + 1):0 is one line no matter c is
because we need to go to new line to reach destination point
Columns are taken into account only if points are on the same line
Point at text: zero-based line and column
Point | |
|
module HsDev.Tools.Refact
module HsDev.Tools.Types