Abstraction on a zipped list. Use these instances to have a list cursored on a position, also called double linked list.
- type Change a = a -> Maybe a
- data Pos
- class Eq a => Engine a where
- empty :: a
- listIn :: [String] -> a
- listOut :: a -> Maybe [String]
- linen :: Int -> a -> Maybe [String]
- line :: a -> Maybe String
- jump :: Int -> Change a
- ins :: [String] -> Change a
- add :: [String] -> Change a
- del :: Change a
- deln :: Int -> Change a
- end :: Change a
- start :: Change a
- pos :: a -> Pos
- next :: Change a
- prev :: Change a
- prevn :: Int -> Change a
- nextn :: Int -> Change a
- rjump :: Int -> Change a
- tillend :: a -> [a]
- fwdcycle :: a -> [a]
- fromstart :: a -> [a]
- bwdcycle :: a -> [a]
- last :: Engine w => Change w
- first :: Engine w => Change w
- newtype W w = W w
- prop_E1 :: Engine w => W w -> String -> Bool
Documentation
Pos represent the position addressed in the engine
class Eq a => Engine a whereSource
relative distance between two positions
the class to implement for holding a list of elements with a cursor on them
An empty engine
An engine is isomorphic to a list
listOut :: a -> Maybe [String]Source
Extract the list from the engine
linen :: Int -> a -> Maybe [String]Source
Extract n lines from the position addressed
line :: a -> Maybe StringSource
Extract the addressed line
Possibly set the addressed line to the nth line
ins :: [String] -> Change aSource
Insert some lines before the addressed line
add :: [String] -> Change aSource
Insert some lines after the addressed line
Delete the addressed line , address the next one
Delete n lines from the addressed position
Address an append position
Address before the first line
The number of the addressed line
Address the next line
Address the prev line
prevn :: Int -> Change aSource
Jump back n lines
nextn :: Int -> Change aSource
Jump ahead n lines
rjump :: Int -> Change aSource
Jump n lines relative to the addredded line
Create all the engines from the addressed one to the last one
all the next engines from the addressed next to itself , wrapping around
Create all the engines from the start to the addressed one included
all the prev engines from the addressed prev to itself , wrapping around