Send Beginners mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."
Today's Topics:
1. Re: REPL with visualisation (Martin Vlk)
2. Re: comment on this debugging trick? (Jeffrey Brown)
3. Re: REPL with visualisation (Mark Fine)
4. Re: comment on this debugging trick? (Stephen Tetley)
5. Anyone suggest .csv file parser? (Jeon-Young Kang)
----------------------------------------------------------------------
Message: 1
Date: Sat, 28 Nov 2015 17:26:58 +0000
From: Martin Vlk <[email protected]>
To: [email protected]
Subject: Re: [Haskell-beginners] REPL with visualisation
Message-ID: <[email protected]>
Content-Type: text/plain; charset=windows-1252
Great to hear people still play with programming - I should do that more
myself! ;-)
Racket has a very nice REPL that lets you display nontextual data, such
as the plot utils for graphs here:
http://docs.racket-lang.org/plot/utils.html
Would be great to get something like this for Haskell.
Otherwise for the Mandelbrot set I'd imagine you could use the
"diagrams" package to specify the graphics using Haskell and then have
it rendered into a file that you load up into browser.
Then you can change the spec, re-generate file and reload in the browser.
M.
emacstheviking:
> Ondrej,
>
> It has just text. Have you seen this though...?
>
> The hackage page...
>
> https://hackage.haskell.org/package/vacuum
>
> and a YouTube video...
>
> https://www.youtube.com/watch?v=X4-212uMgy8
>
> That might be of interest?!
>
> All the best,
> Sean.
>
>
>
>
> On 28 November 2015 at 16:10, Ondrej Nekola <[email protected]
> <mailto:[email protected]>> wrote:
>
> Does it have some support for visual results or just text outputs?
> OSN
>
>> When I was learning it (still learning!) I just use emacs.
>>
>> Top half is my code window, bottom half is a standard "M-x shell"
>> then run ghci. It works. I've tried to use leksah but it is a
>> little "busy" and doesn't really help to keep things simple when
>> you are still learning, IMO anyway.
>>
>>
>> On 28 November 2015 at 15:41, Ondrej Nekola <[email protected]
>> <mailto:[email protected]>> wrote:
>>
>> I can (partially) answer myself: after a bit of experimenting
>> iHaskell (jupyter/ipython + haskell kernel - don't try to
>> install this with cabal, stack works. Don't forget to install
>> native libraries) is quite usable. There is great looking
>> haskellformac (paid) software but as the name suggests it's OS
>> X only.
>> OSN
>>
>>
>> Hi
>> Just curious: is there some recommended "first choice"
>> combination of REPL and libs for (Apple) Swift styled
>> "playgrounds"? (I have just seen a fractalish coffee spill
>> and remembered that I have not implemented Mandelbrot set
>> since high school and Pascal days and maybe it's time to
>> be a bit childish again).
>> Thanks
>> Ondra 'satai' Nekola
>> [email protected] <mailto:[email protected]>
>>
>
> _______________________________________________
> Beginners mailing list
> [email protected] <mailto:[email protected]>
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
>
>
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
------------------------------
Message: 2
Date: Sat, 28 Nov 2015 09:58:44 -0800
From: Jeffrey Brown <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] comment on this debugging trick?
Message-ID:
<CAEc4Ma1451iwkE6gE3P5s5UgWFTjmxZYEdd=xvwdppqvj-d...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
> (Parsec, Attoparsec, ...) can't
> be used with XML.Light because their mechanics are consuming
> an input stream whereas processing XML (or JSON) is
> moving a cursor through a tree
Stephen, the "consuming an input vs. moving a cursor through a tree"
distinction you're drawing is unclear to me. Can you elaborate, or provide
references?
Also, Text.JSON.Parsec [1] would appear to be a counterexample to your
claim.
[1]
https://hackage.haskell.org/package/json-0.9.1/docs/Text-JSON-Parsec.html
On Sat, Nov 28, 2015 at 2:14 AM, Stephen Tetley <[email protected]>
wrote:
> Hi Dennis
>
> For this use case I would make a small, general parser combinator
> library / monad on top of XML.Light, then use the new parser
> combinators to make a specialized parser for your subset MusicXML.
>
> The common parser combinator libraries (Parsec, Attoparsec, ...) can't
> be used with XML.Light because their mechanics are consuming an input
> stream whereas processing XML (or JSON) is moving a cursor through a
> tree, but the common API provided by parser combinator libraries can
> be re-used productively for a tree (cursor) parser. As well as moving
> the cursor, the custom parser monad can handle errors and backtracking
> if needed.
>
> Best wishes
>
> Stephen
>
> On 27 November 2015 at 23:55, Dennis Raddle <[email protected]>
> wrote:
> >
> >
> [snip]
> >
> >
> > I've used the Either monad for exception handling. Yes, I was using do
> > notation. This current project is just for myself. Exceptions represent
> > either bugs or malformed input. I can catch some of them in the IO monad
> so
> > my program prints an error but keeps running and lets me try again. If
> the
> > program crashes out, no big problem.
> >
> > I'm parsing MusicXML with Text.XML.Light. The XML is always well-formed.
> > However *MusicXML* is not a well-defined language. Like, does every
> <note>
> > element have a child element called <voice>? No guarantee I can find,
> yet it
> > has been true in the examples I've tried with the only typesetter I'm
> using
> > to generate MusicXML. I can get my program running quickly without
> > bothering with the case that <voice> is absent. But if that case someday
> > occurs, I want to know precisely and immediately. Yet I don't want to
> write
> > a detailed error message for every violated assumption, of which there
> are
> > dozens necessary. So my solution is to find these things with case
> > exhaustions. The program crashes and I have to inspect the code, but no
> > problem.
> >
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
--
Jeffrey Benjamin Brown
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://mail.haskell.org/pipermail/beginners/attachments/20151128/90401c31/attachment-0001.html>
------------------------------
Message: 3
Date: Sat, 28 Nov 2015 14:52:24 -0800
From: Mark Fine <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] REPL with visualisation
Message-ID:
<canrz_fn4pxm8d90qres71bioqvn+xncwghagr-+r6wbxs00...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
I think that's the approach Haskell for Mac is taking:
http://haskellformac.com/
http://blog.haskellformac.com/blog/fractals-recursion-in-pictures
http://learn.hfm.io/fractals.html
Mark
On Fri, Nov 27, 2015 at 1:13 AM, Ondrej Nekola <[email protected]> wrote:
> Hi
> Just curious: is there some recommended "first choice" combination of REPL
> and libs for (Apple) Swift styled "playgrounds"? (I have just seen a
> fractalish coffee spill and remembered that I have not implemented
> Mandelbrot set since high school and Pascal days and maybe it's time to be
> a bit childish again).
> Thanks
> Ondra 'satai' Nekola
> [email protected]
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://mail.haskell.org/pipermail/beginners/attachments/20151128/c42c46e7/attachment-0001.html>
------------------------------
Message: 4
Date: Sun, 29 Nov 2015 00:31:54 +0000
From: Stephen Tetley <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] comment on this debugging trick?
Message-ID:
<cab2tpra+onrtoacoxjf3p+yh0go_sjk9mgpxg3tn1fwnrch...@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8
Hi Jeffrey
The example you linked to is a JSON parser written with Parsec - it
takes an input stream of characters and returns a JSON tree. To go
from "uni-typed" JSON to Haskell data represented by your domain
datatypes you have to do further conversion. This conversion is from
"tree to tree" rather than "from input stream to tree".
If the correspondence between the JSON (or XML) is one-to-one you can
do a fairly mechanical deserialization (I think some of the libraries
already have Template Haskell processors for this). In Dennis's case
he wants to go from a very large XML representation to deal with a
more manageable subset in Haskell and believes that the input he works
with always belongs to the manageable subset. To get from MusicXML's
large tree - represented again by a uni-typed tree in XML.Light -
parser combinators provide a fine API for the job but the internal
machinary needs to be able to traverse a tree (descend child nodes,
climb back out on failure etc.) rather than consume an input stream.
On 28 November 2015 at 17:58, Jeffrey Brown <[email protected]> wrote:
>> (Parsec, Attoparsec, ...) can't
>> be used with XML.Light because their mechanics are consuming
>> an input stream whereas processing XML (or JSON) is
>> moving a cursor through a tree
>
> Stephen, the "consuming an input vs. moving a cursor through a tree"
> distinction you're drawing is unclear to me. Can you elaborate, or provide
> references?
>
> Also, Text.JSON.Parsec [1] would appear to be a counterexample to your
> claim.
>
> [1]
> https://hackage.haskell.org/package/json-0.9.1/docs/Text-JSON-Parsec.html
------------------------------
Message: 5
Date: Sat, 28 Nov 2015 21:42:58 -0500
From: Jeon-Young Kang <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: [Haskell-beginners] Anyone suggest .csv file parser?
Message-ID:
<calwtik8tpx+syxczzeqymzd+gwcyvm9rh+v4xhsygymp_m6...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
Hi all.
I am working on import *.csv file into haskell.
As you guys recommended, I built code for comparison human's age as follows.
data Person = Person {name:: String, age:: Int } deriving(Show)
data Relations = Friend | Older | Younger
class Comparison a where
compare:: a -> a -> Relations
instance Comparison Person where
compare (Person a b) (Person a b)
| b1 == b2 = Friend
| b1 > b2 = Older
| b1 < b2 = Younger
Also, I have .csv file as follows.
name age
tom 19
jane 21
By using above code, I would like to apply the above code for .csv file.
What is the best for this purpose?
Sincerely,
JY
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://mail.haskell.org/pipermail/beginners/attachments/20151128/185db727/attachment.html>
------------------------------
Subject: Digest Footer
_______________________________________________
Beginners mailing list
[email protected]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
------------------------------
End of Beginners Digest, Vol 89, Issue 52
*****************************************