Haskell programming with turtle graphics, for ages 9–13.
This is an attempt to provide a real Haskell educational programming environment for the youngest possible audience. It’s a Jupyter notebook REPL running Haskell in Visual Studio Code.
Docker and Visual Studio Code must be installed on your system.
This will have to be done by someone who knows how to install and configure software development tools.
You must have Docker installed and running on your system.
https://docs.docker.com/get-docker/
Jupyter support is improving rapidly. You should be on the latest version, at least September 2021.
- Jupyter ms-toolsai.jupyter
- Haskell Syntax Highlighting justusadam.language-haskell
- Remote - Containers ms-vscode-remote.remote-containers
This commandline will install the extensions for you.
code --install-extension ms-toolsai.jupyter && code --install-extension justusadam.language-haskell && code --install-extension ms-vscode-remote.remote-containers
git clone https://github.com/jamesdbrock/testudinal-haskell.git
cd testudinal-haskell
code .
Then make sure you click the popup Reopen in Container button to run the devcontainer.
To run VS Code directly in the devcontainer, you’ll have to first follow these instructions.
Opening a folder directly within a dev container
cd testudinal-haskell
devcontainer open .
Remember to turn off your Vim keybindings for children.
code --disable-extension vscodevim.vim .
These are the essential ingredients, some of which have only become available in 2021, that I think make a very nice Haskell programming environment for children.
-
Browser-based Jupyter is actually pretty dreadful. If you know where to click it works okay, but if you are just experimentally clicking around the window and pressing buttons then you will very soon activate some browser function that takes you away from the page that you're on, which is very confusing.
-
A Jupyter client with an IHaskell kernel and all of the necessary libraries is a massively polyglot multiprocess software system. A container is a pretty ideal way to package and distribute this system. The fact that VS Code can run a Jupyter kernel out of a container is very convenient.
-
The turtle drawing library for the diagrams package.
-
Thanks David Davó for reviving ihaskell-widgets for the IHaskell Jupyter kernel.
-
default (Rational)
andinstance {-# OVERLAPPING #-} Show (Rational)
All numbers are
Rational
by default in the notebook. When aRational
is shown, we show it with the/
operator instead of the%
constructor. So when we compute10/6
the result is5/3
. Anyone who has studied fourth-grade fractions will expect numbers to work this way, and rightly so. It's cruel to inflict IEEE 754 on children. -
Experienced Haskellers just write
$ do
without thinking about it, and they mostly don't notice how crazy and inexplicable that dollar sign is. Thanks, Akio Takano.
Codeworld by Chris Smith thoughts
Codeworld Haskell More Haskelly Codeworld
Learn You a Haskell for Great Good! Jupyter adaptation
Here are some things which need improvement.
-
Error messages.
They’re terrible. We try to pretend in this notebook that Haskell is a simple language with no type annotations but when a type error occurs it’s nonsense to a ten-year-old.