Safe Haskell | None |
---|---|
Language | Haskell2010 |
- breakRepeat :: String -> Int -> Int -> Int
- stringToCommands :: String -> (String, String)
- splitString :: String -> (String, String)
- ioToRender :: IO () -> Render ()
- repeatCommand :: DrawingArea -> String -> Render ()
- repeatRecurse :: DrawingArea -> Int -> String -> Render ()
- updateCanvas :: DrawingArea -> String -> Render ()
- centreTurtle :: DrawingArea -> Render ()
- drawTurtle :: Render ()
Documentation
:: 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
:: 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
:: 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()'
:: 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
.
:: 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
:: 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
.
:: DrawingArea | Drawing Are |
-> Render () |
The centerTurtle
function centers the turtle
It takes one argument DrawingArea
drawTurtle :: Render ()
The drawTurtle
function draws the turtle