Hedi-0.1: Line oriented editor



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 aSource

represent an action, which can fail with Nothing , an index error

data Pos Source

Pos represent the position addressed in the engine



the engine addresses a real line


nth :: Int

The index of the line starting from 1


the engine addresses before first line , if ever present


the engine addresses after last line


lns :: Int

The number of lines 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


empty :: aSource

An empty engine

listIn :: [String] -> aSource

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

jump :: Int -> Change aSource

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

del :: Change aSource

Delete the addressed line , address the next one

deln :: Int -> Change aSource

Delete n lines from the addressed position

end :: Change aSource

Address an append position

start :: Change aSource

Address before the first line

pos :: a -> PosSource

The number of the addressed line

next :: Change aSource

Address the next line

prev :: Change aSource

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

tillend :: a -> [a]Source

Create all the engines from the addressed one to the last one

fwdcycle :: a -> [a]Source

all the next engines from the addressed next to itself , wrapping around

fromstart :: a -> [a]Source

Create all the engines from the start to the addressed one included

bwdcycle :: a -> [a]Source

all the prev engines from the addressed prev to itself , wrapping around


last :: Engine w => Change wSource

last element if present

first :: Engine w => Change wSource

first element if present

newtype W w Source


W w 


Show w => Show (W w) 
(Eq w, Engine w) => Arbitrary (W w) 

prop_E1 :: Engine w => W w -> String -> BoolSource