[Haskell-cafe] Re: Has "Try Haskell! An interactive tutorial in your browser" been announced yet?

Christopher Done chrisdone at googlemail.com
Sun Mar 28 18:00:13 EDT 2010


Hi Benjamin,

Thanks for testing it and providing a detailed report. I've since done
more work on Try Haskell, but not too much. (My job has taken up a
very large amount of my time and energy. I am moving to another one
currently.) I will address your points just to clear it up and maybe
we can discuss where it's going in the future.

On 1 March 2010 12:03, Benjamin L. Russell <DekuDekuplex at yahoo.com> wrote:
>
> Apparently, there is a time limit for this tutorial.
>
> I just tried it out again in Safari 4.0.4 on Mac OS X 10.5.8 Leopard,
> and the tutorial run by the "help" command worked perfectly; however,
> when I then tried it out again in Firefox 3.5.8, the same tutorial
> stopped just after I entered the "'a' : []" expression with the
> following error:
>
> > Time limit exceeded.
>
> This occurred approximately ten minutes after starting the tutorial in
> Safari.
>
> But then I tried the same tutorial approximately four minutes later in
> SeaMonkey 2.0.3, and this time the tutorial ran perfectly again.

I have since updated the "Time limit exceeded" message to be something
more friendly. The cause of this message is that some expressions take
too long to evaluate. Even simple expressions can sometimes take too
long and be killed. To confirm: there is no time limit for the
tutorial.

> So then, approximately four minutes after Firefox had returned the above
> error message, I returned to Firefox, clicked on the "Reset" button in the
> upper-right corner of the page, and restarted the tutorial.  This time,
> the tutorial behaved slightly different from before:  Earlier, I typed
> the following sequence of commands (listed in the first step of the
> tutorial):
>
> > 23*36
> > reverse "hello"
>
> At that point, the tutorial had not started automatically.  However, for
> some reason, this time it did; then, I was able to continue with the
> tutorial until completion.  Then I started the tutorial again with the
> "help" command, and it workd fine again, too.

This was a bug. The cause is simple; the tutorial picks up the types
returned by the REPL and triggers the right tutorial page. Hitting the
reset button, wrongly, did not reset these hooks. I believe this bug
still exists.

>
> Then, about thirty-eight minutes after starting the second tutorial in
> Firefox (during which time I tried to run the tutorial in Camino 2.0.1,
> but Camino froze during the auto-update to 2.0.2, and when I manually
> updated it to 2.0.2, Camino 2.0.2 froze upon startup as well, so I
> finally gave up on trying the tutorial in Camino), I tried out the
> tutorial in Opera 10.10.
>
> For some reason, Opera inserted spaces after typing certain characters,
> and the spaces could not be deleted without also deleting the character
> just before the space as well.  Then I entered the above following sequence
> of commands again:
>
> > 23*36
> > reverse "hello"
>
> Although the tutorial in Opera returned the correct responses to these
> statements, it did not move on to the next step automatically
> afterwards, so I had to type "help" to start the tutorial.  However, I
> was then able to complete the entire tutorial successfully (although the
> extra space bug manifested itself a few times during this tutorial as
> well).

I test on Opera 10.01 on Ubuntu Karmic, but I have seen this bug
elsewhere as someone demonstrated problems with Opera to me at
Zurihac. Opera is quite a fiddly browser compared to Firefox, Webkit
and IE.

I have personally developed it based on the following browsers:

Internet Explorer 6 & 7
Opera 10.01
Chromium 4.0.237.0 (Ubuntu build 31094)
Firefox 3.5.8

But indeed, hopefully I will have more time for testing and
development in the future.

Regarding future work, I hope to integrate Raphael[1] (which I already
did, but is disabled at the moment), exercises the answers to which
are checked by Smallcheck or QuickCheck, access to online feeds a bit
like Yahoo pipes, but one could use Tagsoup, RSS/Atom feeds, etc. to
access some limited set of feeds. I intend on changing the interface
to be like DrScheme, with a code frame and a REPL frame.

I have already added top-level definition of functions, types,
classes, etc. support to the JSON service. For example, here is how we
evaluate an expression, calling the eval method:

http://tryhaskell.org/haskell-eval.json?jsonrpc=2.0&method=eval&id=1&params={"expr":"24*42"}

=>  {"jsonrpc":"2.0","id":"1","result":{"result":"1008","type":"(Num
t) => t","expr":"24*42"}}

Then we can provide it a Haskell file with contents: x=1

http://tryhaskell.org/haskell-eval.json?jsonrpc=2.0&method=load&id=1&params={"contents":"x
= 1"}
=> {"jsonrpc":"2.0","id":"1","result":{"success":""}}

And then evaluate the top level value x:

http://tryhaskell.org/haskell-eval.json?jsonrpc=2.0&method=eval&id=1&params={%22expr%22:%22x%22}
=> {"jsonrpc":"2.0","id":"1","result":{"result":"1","type":"Integer","expr":"x"}}

The only security measure I take is to parse the module with
Language.Haskell.Parser or whatnot and then strip out imports.

Regarding development, I have uploaded everything to Github:

http://github.com/chrisdone/tryhaskell

And I know that one person has managed to build it themselves and run
it locally. I hope that more people will produce interesting things
with it. It can be embedded in books and blogs as a small console for
testing examples, as merely a JSON service, etc.

[1]: Raphaël is a small JavaScript library that should simplify your
work with vector graphics on the web. If you want to create your own
specific chart or image crop and rotate widget, for example, you can
achieve it simply and easily with this library. http://raphaeljs.com/


More information about the Haskell-Cafe mailing list