Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/owickstrom/haskell-robot-lab
An introductory Haskell lab.
https://github.com/owickstrom/haskell-robot-lab
Last synced: 9 days ago
JSON representation
An introductory Haskell lab.
- Host: GitHub
- URL: https://github.com/owickstrom/haskell-robot-lab
- Owner: owickstrom
- Created: 2014-10-20T20:33:30.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2014-10-21T05:51:49.000Z (about 10 years ago)
- Last Synced: 2024-11-08T16:50:36.404Z (2 months ago)
- Language: Haskell
- Size: 140 KB
- Stars: 1
- Watchers: 5
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Haskell Robot Lab
This is an introductory Haskell lab. The primary objective is to implement the
`runAll` function that moves the robot given a string of commands. The commands
are `G`, `R` and `L` for Go, Right and Left respectively.`Robots.hs` defines a simple main function that takes commands as input and
prints the resulting robot and level. Start by implementing `runAll` a couple
of lines down. After that, you can try the extras as well if you want to.## Prerequisites
All you need is GHC and an editor to get going. It is recommended to keep a REPL
running to try out your functions and experiment with new stuff:## Starting the REPL
```
$ cd haskell-robot-lab
$ ghci
...
```### Loading the code
To call your functions from the REPL you need to load the source file.
```
Prelude> :l Robots.hs
[1 of 1] Compiling Main ( Robots.hs, interpreted )
Ok, modules loaded: Main.
Prelude> runAll (0, 0, 0.0) (20, 20) "GGRR"
...
```### The `main` function
You can run the `main` function directly from the REPL to try entering robot
commands.```
Prelude> main
GRGGGGL
...
```### Reloading the code
After editing `Robots.hs` you might want to reload it in the REPL.
```
Prelude> :r
[1 of 1] Compiling Main ( Robots.hs, interpreted )
Ok, modules loaded: Main.
```