Send Beginners mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
http://www.haskell.org/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: A problem about Haskell 99 questions (Arlen Cuss)
2. Re: A problem about Haskell 99 questions (Daniel Fischer)
3. Re: Reading JSON using Text.JSON (Brent Yorgey)
4. Re: Reading JSON using Text.JSON (Adrien Haxaire)
5. learning about exceptions (Jake Penton)
6. shortcut for printing to stderr (Christopher Howard)
7. Haskell on Arm (Christopher Howard)
----------------------------------------------------------------------
Message: 1
Date: Tue, 17 May 2011 20:00:40 +1000
From: Arlen Cuss <[email protected]>
Subject: Re: [Haskell-beginners] A problem about Haskell 99 questions
To: amazingjxq <[email protected]>
Cc: [email protected]
Message-ID: <1305626440.2611.0.camel@asu>
Content-Type: text/plain; charset="utf-8"
On Tue, 2011-05-17 at 17:51 +0800, amazingjxq wrote:
> In problem 7, the example in haskell is below:
>
> *Main> flatten (Elem 5)
> [5]
> *Main> flatten (List [Elem 1, List [Elem 2, List [Elem 3, Elem 4],
> Elem 5]])
> [1,2,3,4,5]
> *Main> flatten (List [])
> []
> What are the functions List and Elem? I cann't hoogle it.
Those would be type constructors for the aforementioned "nested list
structure." I'm not sure if defining that type is part of the problem,
so I won't give it away!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20110517/e2ce9b48/attachment-0001.pgp>
------------------------------
Message: 2
Date: Tue, 17 May 2011 12:02:55 +0200
From: Daniel Fischer <[email protected]>
Subject: Re: [Haskell-beginners] A problem about Haskell 99 questions
To: [email protected]
Message-ID: <[email protected]>
Content-Type: Text/Plain; charset="utf-8"
On Tuesday 17 May 2011 11:51:24, amazingjxq wrote:
> In problem 7 <http://www.haskell.org/haskellwiki/99_questions/1_to_10>,
> the example in haskell is below:
>
> *Main> flatten (Elem 5)
> [5]
> *Main> flatten (List [Elem 1, List [Elem 2, List [Elem 3, Elem 4], Elem
5]])
> [1,2,3,4,5]
> *Main> flatten (List [])
> []
>
> > What are the functions List and Elem? I cann't hoogle it.
They're the constructors of a datatype defined specifically for this
problem. While in Lisp, you can put different types of things in the same
list, Haskell lists are homogeneous (every element has the same type).
So to create nested lists, you have to create a type T that can hold lists
of type T, like
data NestedList a
= Elem a
| List [NestedList a]
(and if you follow the 'Solutions' link at the problem, you find the source
where this is defined).
------------------------------
Message: 3
Date: Tue, 17 May 2011 09:58:31 -0400
From: Brent Yorgey <[email protected]>
Subject: Re: [Haskell-beginners] Reading JSON using Text.JSON
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=us-ascii
On Mon, May 16, 2011 at 10:40:23PM +0200, Adrien Haxaire wrote:
> Hello,
>
> The only thing that I do not understand yet, is why I can't use the
> 'Node' data which I defined in another module. If the Node data
> declaration is in the file in which I read the JSON, it is ok. If I
> import the module in which I want to place it, ghc tells me that the
> data constructor 'Node' is not in scope.
>
> in Input.hs:
> import Elements (Node)
This only imports the Node type and not its constructors. If you want
to import its constructors as well you have to write
import Elements (Node(..))
(just like in the export list of the Elements module).
-Brent
------------------------------
Message: 4
Date: Tue, 17 May 2011 18:35:36 +0200
From: Adrien Haxaire <[email protected]>
Subject: Re: [Haskell-beginners] Reading JSON using Text.JSON
To: Haskell Beginners <[email protected]>
Message-ID: <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Le 17/05/2011 15:58, Brent Yorgey a ?crit :
> import Elements (Node(..))
that works fine now, thanks !
Adrien
------------------------------
Message: 5
Date: Tue, 17 May 2011 17:47:59 -0400
From: Jake Penton <[email protected]>
Subject: [Haskell-beginners] learning about exceptions
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=us-ascii
I am working my way through Real World Haskell. I just finished chapter 8, and
am moving through chapter 9.
I note that RWH uses deprecated "old" exceptions. I am currently importing the
old style exceptions as I work through the code, but would like to learn the
current (new) exception stuff.
Is there a good tutorial on thissomewhere ? Please bear in mind that at my
state of knowledge it is still rather difficult to get this knowledge by
reading the library documentation alone. I am not all that great at inferring
what is going on just by inspecting signatures, etc.
Is ch.19 of RWH (which covers exceptions in more depth) still relevant to "new"
exceptions?
Thanks.
- Jake -
------------------------------
Message: 6
Date: Tue, 17 May 2011 21:45:48 -0800
From: Christopher Howard <[email protected]>
Subject: [Haskell-beginners] shortcut for printing to stderr
To: Haskell Beginners <[email protected]>
Message-ID: <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1
I use a formula like this very often:
hPutStrLn stderr "error message"
Is there not some shortcut function in base that prints to stderr
without having to pass in the handle? Obviously it is not hard to define
one, but it would be neat to know if there was already one in base. (I
couldn't seem to find one in the System.IO listing.)
--
frigidcode.com
theologia.indicium.us
------------------------------
Message: 7
Date: Tue, 17 May 2011 21:58:48 -0800
From: Christopher Howard <[email protected]>
Subject: [Haskell-beginners] Haskell on Arm
To: Haskell Beginners <[email protected]>
Message-ID: <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1
(I hope two questions in one night is okay...)
I was wondering how "doable" it would be to compile and run Haskell code
on Arm. I was thinking about buying one of those tiny, inexpensive Arm
PCs (there are quite a few models, apparently) and running Gentoo Linux
on it. But it would be a lot cooler if I knew I would be able to run
Haskell code on it as well.
The GHC platforms page indicated only bare-minimum tier 2 support, and I
couldn't seem to find any kind of "road map" tutorials to give me an
idea what kind of challenges I would face.
--
frigidcode.com
theologia.indicium.us
------------------------------
_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners
End of Beginners Digest, Vol 35, Issue 36
*****************************************