This repo contains Jupyter notebook/presentation and supporting Ammonite scripts for the Functional Programming COP talk on Tagless Final DSLs in Scala.
This assumes you have Python and pip
installed. Using a virtualenv
or
Anaconda/miniconda
environment is also recommended.
-
Install
jupyter
:pip install jupyter
-
Install the
almond
Scala kernel for Jupyter.
$ SCALA_VERSION=2.12.7 ALMOND_VERSION=0.1.11
$ coursier bootstrap \
-i user -I user:sh.almond:scala-kernel-api_$SCALA_VERSION:$ALMOND_VERSION \
sh.almond:scala-kernel_$SCALA_VERSION:$ALMOND_VERSION \
-o almond
$ ./almond --install
More comprehensive instructions for installing almond
can be found on the
almond
website.
In order to run the Ammonite scripts, you will need to install Ammonite. Installations instructions can be found on the Ammonite website.
Homebrew can be used to install Ammonite on Mac OS:
$ brew install ammonite-repl
- Clone or download this repository:
$ cd /path/to/projects
$ git clone https://github.com/keithschulze/fp-cop-tagless-final
- Navigate to the cloned repository and run Jupyter notebook server.
$ cd /path/to/projects/fp-cop-tagless-final
$ jupyter notebook
Note: Remember to activate your virtualenv
if you installed Jupyter in one.
Note: Almond only seems to work with JDK1.8. If your kernel fails to start, see
these
instructions.
$ cd /path/to/projects/fp-cop-tagless-final
$ amm banking.sc
$ amm imgprocessor.sc
$ cd /path/to/projects/fp-cop-tagless-final
$ jupyter nbconvert fp-cop-tagless-final.ipynb --to slides --post serve