Discussion:
[elm-discuss] Help with Jupyter/IPython notebook kernel for Elm
Austin Bingham
2017-03-27 18:10:33 UTC
Permalink
Hi everyone,

I started hacking a bit today on a Jupyter notebook kernel for elm. You can
see it here:

https://github.com/abingham/jupyter-elm-kernel
<https://github.com/abingham/jupyter-elm-kernel>

It doesn't quite work yet, though, and I think I need help from someone who
knows javascript/requirejs/web stuff a bit better than me. The proximal
problem I'm seeing is that when jupyter tries to run the elm-make-generated
javascript, it thinks that 'Elm' is undefined during (I think) some part of
the AMD machinery. Jupyter show this as the output for the cell:

Javascript error adding output!
ReferenceError: Elm is not defined
See your browser Javascript console for more details.

As far as I can see, Elm *should* be defined, and certainly the generated
code looks like any other Elm output I've looked at. So I'm a bit stumped.

My approach to the kernel is currently very simple. The kernel is
implemented in Python, and it receives a blob of Elm source code. I dump
this to a temp file, use a subprocess to run "elm-make" to make the output,
read the output, and ship it back to jupyter. As far as I can see, all of
that is working properly. I run into problems when jupyter tries to execute
the stuff I return. This design may or may not be optimal in the long run,
but I want to get the plumbing working first.

So if someone feels up to the challenge, I'd love any help I could get.
This seems like it should be pretty straightforward, but perhaps I'm being
naive and/or missing something obvious.

Of course, I'm also happy to discuss other aspects of the kernel (e.g.
design, compilation technique, etc.), but my priority is to just get
something into an output cell.
--
You received this message because you are subscribed to the Google Groups "Elm Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elm-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Austin Bingham
2017-03-28 07:42:49 UTC
Permalink
FWIW, I see that when the generated javascript is passed back to the
Jupyter client, the client calls eval() on the javascript. This seems to
work OK, insofar as it doesn't throw an exception. However - and this is
where I'm a bit out of my depth - none of the bindings made in the
javascript seem to be available in the calling context. Maybe this is the
nature of eval(), but I'm not sure. The "ReferenceError" I reported
initially seems to actually come from when I try to use the "Elm" object to
embed the app in a DOM object.
Post by Austin Bingham
Hi everyone,
I started hacking a bit today on a Jupyter notebook kernel for elm. You
https://github.com/abingham/jupyter-elm-kernel
<https://github.com/abingham/jupyter-elm-kernel>
It doesn't quite work yet, though, and I think I need help from someone
who knows javascript/requirejs/web stuff a bit better than me. The proximal
problem I'm seeing is that when jupyter tries to run the elm-make-generated
javascript, it thinks that 'Elm' is undefined during (I think) some part of
Javascript error adding output!
ReferenceError: Elm is not defined
See your browser Javascript console for more details.
As far as I can see, Elm *should* be defined, and certainly the generated
code looks like any other Elm output I've looked at. So I'm a bit stumped.
My approach to the kernel is currently very simple. The kernel is
implemented in Python, and it receives a blob of Elm source code. I dump
this to a temp file, use a subprocess to run "elm-make" to make the output,
read the output, and ship it back to jupyter. As far as I can see, all of
that is working properly. I run into problems when jupyter tries to execute
the stuff I return. This design may or may not be optimal in the long run,
but I want to get the plumbing working first.
So if someone feels up to the challenge, I'd love any help I could get.
This seems like it should be pretty straightforward, but perhaps I'm being
naive and/or missing something obvious.
Of course, I'm also happy to discuss other aspects of the kernel (e.g.
design, compilation technique, etc.), but my priority is to just get
something into an output cell.
--
You received this message because you are subscribed to the Google Groups "Elm Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elm-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Berry Groenendijk
2017-03-28 14:53:47 UTC
Permalink
Hi Austin,

I like Jupyter/iPython a lot as a concept. I did not use it a lot though.
And Elm seems to be like a natural fit.

My dream would be to have live aka. living documents where static text and
live code are intermingled. Jupyter is a step in the right direction. But,
you still need a server.

Just recently I found a thing called Klipse, see:
http://blog.klipse.tech/javascript/2016/06/20/blog-javascript.html. It
looks a lot like Jupyter (minus the document editing, but that should be
trivial), but all the code is executed in the browser! It currently has
support for clojure, ruby, javascript, python, scheme, es2017, jsx,
brainfuck, c++ and Lua. Quite impressive. And if javascript works, them Elm
should also work. Perhaps it is already possible... import elm.js...
hmmm... I don't know.

Sorry, if this post isn't directly related to Jupyter and your challenge to
integrate Elm in Jupyter.
Post by Austin Bingham
Hi everyone,
I started hacking a bit today on a Jupyter notebook kernel for elm. You
https://github.com/abingham/jupyter-elm-kernel
<https://github.com/abingham/jupyter-elm-kernel>
It doesn't quite work yet, though, and I think I need help from someone
who knows javascript/requirejs/web stuff a bit better than me. The proximal
problem I'm seeing is that when jupyter tries to run the elm-make-generated
javascript, it thinks that 'Elm' is undefined during (I think) some part of
Javascript error adding output!
ReferenceError: Elm is not defined
See your browser Javascript console for more details.
As far as I can see, Elm *should* be defined, and certainly the generated
code looks like any other Elm output I've looked at. So I'm a bit stumped.
My approach to the kernel is currently very simple. The kernel is
implemented in Python, and it receives a blob of Elm source code. I dump
this to a temp file, use a subprocess to run "elm-make" to make the output,
read the output, and ship it back to jupyter. As far as I can see, all of
that is working properly. I run into problems when jupyter tries to execute
the stuff I return. This design may or may not be optimal in the long run,
but I want to get the plumbing working first.
So if someone feels up to the challenge, I'd love any help I could get.
This seems like it should be pretty straightforward, but perhaps I'm being
naive and/or missing something obvious.
Of course, I'm also happy to discuss other aspects of the kernel (e.g.
design, compilation technique, etc.), but my priority is to just get
something into an output cell.
--
You received this message because you are subscribed to the Google Groups "Elm Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elm-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Noah Hall
2017-03-28 14:55:45 UTC
Permalink
If you join the https://elmlang.slack.com and join #elm-dev, I can
help you out (eeue56)

On Tue, Mar 28, 2017 at 4:53 PM, Berry Groenendijk
Post by Berry Groenendijk
Hi Austin,
I like Jupyter/iPython a lot as a concept. I did not use it a lot though.
And Elm seems to be like a natural fit.
My dream would be to have live aka. living documents where static text and
live code are intermingled. Jupyter is a step in the right direction. But,
you still need a server.
http://blog.klipse.tech/javascript/2016/06/20/blog-javascript.html. It looks
a lot like Jupyter (minus the document editing, but that should be trivial),
but all the code is executed in the browser! It currently has support for
clojure, ruby, javascript, python, scheme, es2017, jsx, brainfuck, c++ and
Lua. Quite impressive. And if javascript works, them Elm should also work.
Perhaps it is already possible... import elm.js... hmmm... I don't know.
Sorry, if this post isn't directly related to Jupyter and your challenge to
integrate Elm in Jupyter.
Post by Austin Bingham
Hi everyone,
I started hacking a bit today on a Jupyter notebook kernel for elm. You
https://github.com/abingham/jupyter-elm-kernel
It doesn't quite work yet, though, and I think I need help from someone
who knows javascript/requirejs/web stuff a bit better than me. The proximal
problem I'm seeing is that when jupyter tries to run the elm-make-generated
javascript, it thinks that 'Elm' is undefined during (I think) some part of
Javascript error adding output!
ReferenceError: Elm is not defined
See your browser Javascript console for more details.
As far as I can see, Elm *should* be defined, and certainly the generated
code looks like any other Elm output I've looked at. So I'm a bit stumped.
My approach to the kernel is currently very simple. The kernel is
implemented in Python, and it receives a blob of Elm source code. I dump
this to a temp file, use a subprocess to run "elm-make" to make the output,
read the output, and ship it back to jupyter. As far as I can see, all of
that is working properly. I run into problems when jupyter tries to execute
the stuff I return. This design may or may not be optimal in the long run,
but I want to get the plumbing working first.
So if someone feels up to the challenge, I'd love any help I could get.
This seems like it should be pretty straightforward, but perhaps I'm being
naive and/or missing something obvious.
Of course, I'm also happy to discuss other aspects of the kernel (e.g.
design, compilation technique, etc.), but my priority is to just get
something into an output cell.
--
You received this message because you are subscribed to the Google Groups
"Elm Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Elm Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elm-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Austin Bingham
2017-03-28 16:37:47 UTC
Permalink
Klipse looks interesting, but I'm hoping to use Jupyter to make a
presentation so I'm going to stick with that for now.

Regarding Jupyter needing a server: there are places that host notebooks,
so the server requirement is only partly true. Your point is a good one,
though. Sometime the complexity of jupyter can seem a bit unwieldy.
Post by Berry Groenendijk
Hi Austin,
I like Jupyter/iPython a lot as a concept. I did not use it a lot though.
And Elm seems to be like a natural fit.
My dream would be to have live aka. living documents where static text and
live code are intermingled. Jupyter is a step in the right direction. But,
you still need a server.
http://blog.klipse.tech/javascript/2016/06/20/blog-javascript.html. It
looks a lot like Jupyter (minus the document editing, but that should be
trivial), but all the code is executed in the browser! It currently has
support for clojure, ruby, javascript, python, scheme, es2017, jsx,
brainfuck, c++ and Lua. Quite impressive. And if javascript works, them Elm
should also work. Perhaps it is already possible... import elm.js...
hmmm... I don't know.
Sorry, if this post isn't directly related to Jupyter and your challenge
to integrate Elm in Jupyter.
Post by Austin Bingham
Hi everyone,
I started hacking a bit today on a Jupyter notebook kernel for elm. You
https://github.com/abingham/jupyter-elm-kernel
<https://github.com/abingham/jupyter-elm-kernel>
It doesn't quite work yet, though, and I think I need help from someone
who knows javascript/requirejs/web stuff a bit better than me. The proximal
problem I'm seeing is that when jupyter tries to run the elm-make-generated
javascript, it thinks that 'Elm' is undefined during (I think) some part of
Javascript error adding output!
ReferenceError: Elm is not defined
See your browser Javascript console for more details.
As far as I can see, Elm *should* be defined, and certainly the generated
code looks like any other Elm output I've looked at. So I'm a bit stumped.
My approach to the kernel is currently very simple. The kernel is
implemented in Python, and it receives a blob of Elm source code. I dump
this to a temp file, use a subprocess to run "elm-make" to make the output,
read the output, and ship it back to jupyter. As far as I can see, all of
that is working properly. I run into problems when jupyter tries to execute
the stuff I return. This design may or may not be optimal in the long run,
but I want to get the plumbing working first.
So if someone feels up to the challenge, I'd love any help I could get.
This seems like it should be pretty straightforward, but perhaps I'm being
naive and/or missing something obvious.
Of course, I'm also happy to discuss other aspects of the kernel (e.g.
design, compilation technique, etc.), but my priority is to just get
something into an output cell.
--
You received this message because you are subscribed to the Google Groups "Elm Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elm-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Michael Lamb
2017-04-08 17:51:16 UTC
Permalink
Are you still looking for a hand with this, Austin?

I'm not an expert, or anything but I'm really interested in making a good
Jupyter kernel for Elm to use with nteract. If you haven't seen it, check
it out: https://nteract.io/
It mimics Jupyter as a desktop application, so you do not need a server.
Post by Austin Bingham
Hi everyone,
I started hacking a bit today on a Jupyter notebook kernel for elm. You
https://github.com/abingham/jupyter-elm-kernel
<https://github.com/abingham/jupyter-elm-kernel>
It doesn't quite work yet, though, and I think I need help from someone
who knows javascript/requirejs/web stuff a bit better than me. The proximal
problem I'm seeing is that when jupyter tries to run the elm-make-generated
javascript, it thinks that 'Elm' is undefined during (I think) some part of
Javascript error adding output!
ReferenceError: Elm is not defined
See your browser Javascript console for more details.
As far as I can see, Elm *should* be defined, and certainly the generated
code looks like any other Elm output I've looked at. So I'm a bit stumped.
My approach to the kernel is currently very simple. The kernel is
implemented in Python, and it receives a blob of Elm source code. I dump
this to a temp file, use a subprocess to run "elm-make" to make the output,
read the output, and ship it back to jupyter. As far as I can see, all of
that is working properly. I run into problems when jupyter tries to execute
the stuff I return. This design may or may not be optimal in the long run,
but I want to get the plumbing working first.
So if someone feels up to the challenge, I'd love any help I could get.
This seems like it should be pretty straightforward, but perhaps I'm being
naive and/or missing something obvious.
Of course, I'm also happy to discuss other aspects of the kernel (e.g.
design, compilation technique, etc.), but my priority is to just get
something into an output cell.
--
You received this message because you are subscribed to the Google Groups "Elm Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elm-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Austin Bingham
2017-04-10 18:12:21 UTC
Permalink
The basic kernel is working at this point, and you can get it here:
https://github.com/abingham/jupyter-elm-kernel

But there's still quite a bit to be done, and some of the design decisions
I made might be short-sighted. Take it for a spin and let me know what you
think. Any feedback, ideas, PRs, etc. would be great.
Post by Michael Lamb
Are you still looking for a hand with this, Austin?
I'm not an expert, or anything but I'm really interested in making a good
Jupyter kernel for Elm to use with nteract. If you haven't seen it, check
it out: https://nteract.io/
It mimics Jupyter as a desktop application, so you do not need a server.
Hi everyone,
I started hacking a bit today on a Jupyter notebook kernel for elm. You
https://github.com/abingham/jupyter-elm-kernel
<https://github.com/abingham/jupyter-elm-kernel>
It doesn't quite work yet, though, and I think I need help from someone
who knows javascript/requirejs/web stuff a bit better than me. The proximal
problem I'm seeing is that when jupyter tries to run the elm-make-generated
javascript, it thinks that 'Elm' is undefined during (I think) some part of
Javascript error adding output!
ReferenceError: Elm is not defined
See your browser Javascript console for more details.
As far as I can see, Elm *should* be defined, and certainly the generated
code looks like any other Elm output I've looked at. So I'm a bit stumped.
My approach to the kernel is currently very simple. The kernel is
implemented in Python, and it receives a blob of Elm source code. I dump
this to a temp file, use a subprocess to run "elm-make" to make the output,
read the output, and ship it back to jupyter. As far as I can see, all of
that is working properly. I run into problems when jupyter tries to execute
the stuff I return. This design may or may not be optimal in the long run,
but I want to get the plumbing working first.
So if someone feels up to the challenge, I'd love any help I could get.
This seems like it should be pretty straightforward, but perhaps I'm being
naive and/or missing something obvious.
Of course, I'm also happy to discuss other aspects of the kernel (e.g.
design, compilation technique, etc.), but my priority is to just get
something into an output cell.
--
You received this message because you are subscribed to a topic in the
Google Groups "Elm Discuss" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/elm-discuss/4VUQuYukGXM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Elm Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elm-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
douglas smith
2017-05-04 01:40:13 UTC
Permalink
very nice! just found this thread today... seems to install and run just
fine. i have a test running on aws
is it possible to have single expressions eval as in elm-repl ?
i know they are two different systems
let me know if i can help with anything- doug
Post by Austin Bingham
Hi everyone,
I started hacking a bit today on a Jupyter notebook kernel for elm. You
https://github.com/abingham/jupyter-elm-kernel
<https://github.com/abingham/jupyter-elm-kernel>
It doesn't quite work yet, though, and I think I need help from someone
who knows javascript/requirejs/web stuff a bit better than me. The proximal
problem I'm seeing is that when jupyter tries to run the elm-make-generated
javascript, it thinks that 'Elm' is undefined during (I think) some part of
Javascript error adding output!
ReferenceError: Elm is not defined
See your browser Javascript console for more details.
As far as I can see, Elm *should* be defined, and certainly the generated
code looks like any other Elm output I've looked at. So I'm a bit stumped.
My approach to the kernel is currently very simple. The kernel is
implemented in Python, and it receives a blob of Elm source code. I dump
this to a temp file, use a subprocess to run "elm-make" to make the output,
read the output, and ship it back to jupyter. As far as I can see, all of
that is working properly. I run into problems when jupyter tries to execute
the stuff I return. This design may or may not be optimal in the long run,
but I want to get the plumbing working first.
So if someone feels up to the challenge, I'd love any help I could get.
This seems like it should be pretty straightforward, but perhaps I'm being
naive and/or missing something obvious.
Of course, I'm also happy to discuss other aspects of the kernel (e.g.
design, compilation technique, etc.), but my priority is to just get
something into an output cell.
--
You received this message because you are subscribed to the Google Groups "Elm Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elm-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Austin Bingham
2017-05-04 06:38:06 UTC
Permalink
There isn't currently any elm-repl support, though there's an open issue
for it: https://github.com/abingham/jupyter-elm-kernel/issues/9

I'm not entirely sure how it should work, both from the user's perspective
or technically, so any ideas would be great.
Post by douglas smith
very nice! just found this thread today... seems to install and run just
fine. i have a test running on aws
is it possible to have single expressions eval as in elm-repl ?
i know they are two different systems
let me know if i can help with anything- doug
Post by Austin Bingham
Hi everyone,
I started hacking a bit today on a Jupyter notebook kernel for elm. You
https://github.com/abingham/jupyter-elm-kernel
<https://github.com/abingham/jupyter-elm-kernel>
It doesn't quite work yet, though, and I think I need help from someone
who knows javascript/requirejs/web stuff a bit better than me. The proximal
problem I'm seeing is that when jupyter tries to run the elm-make-generated
javascript, it thinks that 'Elm' is undefined during (I think) some part of
Javascript error adding output!
ReferenceError: Elm is not defined
See your browser Javascript console for more details.
As far as I can see, Elm *should* be defined, and certainly the generated
code looks like any other Elm output I've looked at. So I'm a bit stumped.
My approach to the kernel is currently very simple. The kernel is
implemented in Python, and it receives a blob of Elm source code. I dump
this to a temp file, use a subprocess to run "elm-make" to make the output,
read the output, and ship it back to jupyter. As far as I can see, all of
that is working properly. I run into problems when jupyter tries to execute
the stuff I return. This design may or may not be optimal in the long run,
but I want to get the plumbing working first.
So if someone feels up to the challenge, I'd love any help I could get.
This seems like it should be pretty straightforward, but perhaps I'm being
naive and/or missing something obvious.
Of course, I'm also happy to discuss other aspects of the kernel (e.g.
design, compilation technique, etc.), but my priority is to just get
something into an output cell.
--
You received this message because you are subscribed to a topic in the
Google Groups "Elm Discuss" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/elm-discuss/4VUQuYukGXM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Elm Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elm-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...