logo

Safe HaskellNone
LanguageHaskell2010

Parsers

Synopsis

Documentation

breakRepeat

Arguments

:: String

String to get position of corresponding ']' of the repeat

-> Int

Number of brackets not closed

-> Int

Current position

-> Int

Return position of ']'

The breakRepeat function gets the position of end of the repeat statement It takes a String and two Int as arguments and returns an Int

stringToCommands

Arguments

:: String

String to get command from

-> (String, String)

Return the command and the rest of the string as a pair

The stringToCommands function converts the input string into commands It takes a String as argument and returns a pair of String

splitString

Arguments

:: String

String to split

-> (String, String)

Pair of string formed after splitting the string

The splitString function breaks the string at first space It takes a String as argument and returns a pair of String

ioToRender :: IO () -> Render ()

The ioToRender function converts IO() to Render() It takes an argument of type 'IO()' and returns an argument of type 'Render()'

repeatCommand

Arguments

:: DrawingArea

The drawing area in which drawing takes place

-> String

String containing commands to be repeated

-> Render () 

The repeatCommand function acts as a helper function to repeatRecurse It takes one argument of type DrawingArea, one argument of type String.

repeatRecurse

Arguments

:: DrawingArea

The drawing area in which drawing takes place

-> Int

Number of times

-> String

String of the commands to be executed

-> Render () 

The repeatRecurse function is used to execute commands containing the repeat statement It takes one argument of type DrawingArea, one argument of type Int, one argument of type String

updateCanvas

Arguments

:: DrawingArea

The drawing area in which drawing takes place

-> String

String of commands to be executed

-> Render () 

The updateCanvas function is responsible for executing the command provided. This function uses the functions declared in hs.

centreTurtle

Arguments

:: DrawingArea

Drawing Are

-> Render () 

The centerTurtle function centers the turtle It takes one argument DrawingArea

drawTurtle :: Render ()

The drawTurtle function draws the turtle