[Haskell-cafe] Visualising Haskell function execution

Gregory D. Weber gdweber at iue.edu
Sat Aug 9 19:29:02 UTC 2014


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



More information about the Haskell-Cafe mailing list