Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/epost/purescript-free-turtle
A toy turtle graphics interpreter based on the Free monad, in PureScript, with HTML Canvas graphics support.
https://github.com/epost/purescript-free-turtle
free-monad purescript turtle-graphics tutorial-code
Last synced: 12 days ago
JSON representation
A toy turtle graphics interpreter based on the Free monad, in PureScript, with HTML Canvas graphics support.
- Host: GitHub
- URL: https://github.com/epost/purescript-free-turtle
- Owner: epost
- License: mit
- Created: 2014-10-27T00:52:37.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2020-10-01T21:41:57.000Z (about 4 years ago)
- Last Synced: 2024-10-30T06:29:00.489Z (about 2 months ago)
- Topics: free-monad, purescript, turtle-graphics, tutorial-code
- Language: PureScript
- Homepage:
- Size: 35.2 KB
- Stars: 16
- Watchers: 3
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.org
- License: LICENSE
Awesome Lists containing this project
README
#+title: PureScript Free Turtle interpreter
A simple Turtle graphics system implemented using a ~Free~ monad, intended for educational purposes. It comes with an interpreter that translates programs in the Turtle language to HTML canvas graphics.
[[file:img/two-stars.png]]
#+BEGIN_SRC purescript
main :: Effect Context2D
main = CanvasInterpreter.render "turtleCanvas" do
color Purple
starforward 40.0
left 100.0color Red
starstar = do
penDown
right 144.0
forward 100.0
right 144.0
forward 100.0
right 144.0
forward 100.0
right 144.0
forward 100.0
right 144.0
forward 100.0
penUp
#+END_SRC* Usage
In your shell, type:
: npm install
: npm run build
: npm run bundleThen point your browser to [[./html/index.html]].