Jan Paul Posma | 8 Aug 07:30 2014
Picon

Visualising Haskell function execution

Hey all,

Last weekend my friend Steve and I did a small project for visualising Haskell function execution in the browser. It's meant to be used in education, and uses a tiny custom parser. I figured it could be of interest for anyone here learning or teaching Haskell: https://stevekrouse.github.io/hs.js/

To see it in action, scroll a bit down to the red bordered box, and click on "map", and then keep clicking on each new line.

I hope it can be useful to someone.

Cheers, JP
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
Dominick Samperi | 8 Aug 17:52 2014
Picon

Re: Visualising Haskell function execution

If I recall correctly the Leksah IDE shows GHC reduction step-by-step
(using GHC debug info). Unfortunately, the last update was in 2012, so
it appears
that it has not been following the latest GHC releases.

On Fri, Aug 8, 2014 at 1:30 AM, Jan Paul Posma <me <at> janpaulposma.nl> wrote:
> Hey all,
>
> Last weekend my friend Steve and I did a small project for visualising
> Haskell function execution in the browser. It's meant to be used in
> education, and uses a tiny custom parser. I figured it could be of interest
> for anyone here learning or teaching Haskell:
> https://stevekrouse.github.io/hs.js/
>
> To see it in action, scroll a bit down to the red bordered box, and click on
> "map", and then keep clicking on each new line.
>
> I hope it can be useful to someone.
>
> Cheers, JP
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe <at> haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
Henk-Jan van Tuyl | 13 Aug 14:10 2014
Picon

Re: Visualising Haskell function execution

On Fri, 08 Aug 2014 17:52:38 +0200, Dominick Samperi <djsamperi <at> gmail.com>  
wrote:

> If I recall correctly the Leksah IDE shows GHC reduction step-by-step
> (using GHC debug info). Unfortunately, the last update was in 2012, so
> it appears
> that it has not been following the latest GHC releases.

Leksah still works, but it is not finished; it is only possible to step  
per (sub)expression, no stepping to the end of a function. The debugger  
has therefore a very limited use. I hope that a group of people will  
continue the development, an application like that is too big for one  
person.

Regards,
Henk-Jan van Tuyl

--

-- 
Folding <at> home
What if you could share your unused computer power to help find a cure? In  
just 5 minutes you can join the world's biggest networked computer and get  
us closer sooner. Watch the video.
http://folding.stanford.edu/

http://Van.Tuyl.eu/
http://members.chello.nl/hjgtuyl/tourdemonad.html
Haskell programming
--
Kim-Ee Yeoh | 8 Aug 23:35 2014

Re: Visualising Haskell function execution


On Fri, Aug 8, 2014 at 12:30 PM, Jan Paul Posma <me <at> janpaulposma.nl> wrote:
Last weekend my friend Steve and I did a small project for visualising Haskell function execution in the browser. It's meant to be used in education, and uses a tiny custom parser. I figured it could be of interest for anyone here learning or teaching Haskell: https://stevekrouse.github.io/hs.js/

Mind if I suggest posting to the haskell reddit /r/haskell ?

Tons of people would find it useful there and share it forward.

-- Kim-Ee
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
Jan Paul Posma | 9 Aug 01:18 2014
Picon

Re: Visualising Haskell function execution

Of course, thanks!

Also, the code is open source and can easily be used in other courses, that page is just our example.

JP


On Fri, Aug 8, 2014 at 2:35 PM, Kim-Ee Yeoh <ky3 <at> atamo.com> wrote:

On Fri, Aug 8, 2014 at 12:30 PM, Jan Paul Posma <me <at> janpaulposma.nl> wrote:
Last weekend my friend Steve and I did a small project for visualising Haskell function execution in the browser. It's meant to be used in education, and uses a tiny custom parser. I figured it could be of interest for anyone here learning or teaching Haskell: https://stevekrouse.github.io/hs.js/

Mind if I suggest posting to the haskell reddit /r/haskell ?

Tons of people would find it useful there and share it forward.

-- Kim-Ee

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
Jerzy Karczmarczuk | 9 Aug 02:06 2014
Picon

Re: Visualising Haskell function execution

Jan Paul Posma <me <at> janpaulposma.nl> wrote:

Last weekend my friend Steve and I did a small project for visualising Haskell function execution in the browser. It's meant to be used in education, and uses a tiny custom parser. I figured it could be of interest for anyone here learning or teaching Haskell: https://stevekrouse.github.io/hs.js/

Indeed, this is a nice, and potentially useful initiative, thanks.

I have some observations, though.

1. Before its "wide distribution" as suggested by Kim-Ee, it would be nice to provide a minimum documentation on the project page.

2. It is not always clear what is the relation between the work of the system, the expression expansion, and what Haskell REALLY does.
For, say: (foldr plus 0 [1 2 3 4 5]) the development/reduction depends on what you click. You may get

(plus 1 (plus 2 (foldr plus 0 [3 4 5])))   or
(1 + (foldr plus 0 [2 3 4 5]))

and a beginner might have serious problems to understand what really happens in a true Haskell program.

3. The system accepts typing abominations, say,
(foldl plus [] [1 2 3 4 5]) and joyfully develops the structure, which cannot be finally reduced.

4. 
I don't understand the relation between the typing and the behaviour. I tested foldl with my own function put into the function editor: const x y = x without type declaration.
The expression is expanded, but never reduced, const remains in the final expression. When const type is declared, it is reduced.

5.  I tried to define my own recursive function (a factorial) and test it replacing one of the standard examples. This breaks the system. If it is not allowed, please say so explicitly. If I did something silly, please see my point (1).

My best regards, and thank you once more.

Jerzy Karczmarczuk
Caen, France


_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
Gregory D. Weber | 9 Aug 21:29 2014

Re: Visualising Haskell function execution

On 2014-Aug-09, Jerzy Karczmarczuk wrote:
> Jan Paul Posma <me <at> janpaulposma.nl <mailto:me <at> janpaulposma.nl>> wrote:
> 
> >    Last weekend my friend Steve and I did a small project for
> >    visualising Haskell function execution in the browser. It's meant
> >    to be used in education, and uses a tiny custom parser. I figured
> >    it could be of interest for anyone here learning or teaching
> >    Haskell: https://stevekrouse.github.io/hs.js/
> >
> 
> Indeed, this is a nice, and potentially useful initiative, thanks.
> 
> I have some observations, though.
> 
> 1. Before its "wide distribution" as suggested by Kim-Ee, it would
> be nice to provide a minimum documentation on the project page.
> 
> 2. It is not always clear what is the relation between the work of
> the system, the expression expansion, and what Haskell REALLY does.
> For, say: (foldr plus 0 [1 2 3 4 5]) the development/reduction
> depends on what you click. You may get
> 
> (plus1(plus2(foldrplus0[3 45]))) or
> (1+(foldrplus0[2 345]))
> 
> and a beginner might have serious problems to understand what really
> happens in a true Haskell program.
> 
> 3. The system accepts typing abominations, say, (foldlplus[][1 234
> 5]) and joyfully develops the structure, which cannot be finally
> reduced.
> 
> 4. I don't understand the relation between the typing and the
> behaviour. I tested foldl with my own function put into the function
> editor: const x y = x without type declaration.
> The expression is expanded, but never reduced, const remains in the
> final expression. When const type is declared, it is reduced.
> 
> 5.  I tried to define my own recursive function (a factorial) and
> test it replacing one of the standard examples. This breaks the
> system. If it is not allowed, please say so explicitly. If I did
> something silly, please see my point (1).

From the pink error messages I'm seeing today (though I don't remember
seeing them yesterday when I tried something similar), it looks like
the * operator is not supported; the only numerical operators are + and - 

> 
> My best regards, and thank you once more.
> 
> Jerzy Karczmarczuk
> Caen, France
> 
> 

> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe <at> haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe

--

-- 
Gregory D. Weber, Ph. D.                  http://mypage.iu.edu/~gdweber/
Associate Professor of Informatics        Tel (765) 973-8420
Indiana University East                   FAX (765) 973-8550
Bob Ippolito | 9 Aug 22:08 2014

Re: Visualising Haskell function execution

On Thu, Aug 7, 2014 at 10:30 PM, Jan Paul Posma <me <at> janpaulposma.nl> wrote:
Hey all,

Last weekend my friend Steve and I did a small project for visualising Haskell function execution in the browser. It's meant to be used in education, and uses a tiny custom parser. I figured it could be of interest for anyone here learning or teaching Haskell: https://stevekrouse.github.io/hs.js/

To see it in action, scroll a bit down to the red bordered box, and click on "map", and then keep clicking on each new line.

I hope it can be useful to someone.

Thanks for posting this! It looks potentially quite useful, especially in an educational context. I think the part that's missing for me is that it doesn't make it so explicit that pattern matching is what typically forces evaluation, here you simply decide where to evaluate by clicking on that part of the term. Maybe there could be an implicit "print" forcing evaluation or something like that could be useful?

-bob
 
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Gmane