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. Questions on type declarations ([email protected])
2. Re: Questions on type declarations (brandon s allbery kf8nh)
----------------------------------------------------------------------
Message: 1
Date: Fri, 5 Oct 2012 19:55:51 -0400 (EDT)
From: [email protected]
Subject: [Haskell-beginners] Questions on type declarations
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain;charset=iso-8859-1
Hi,
Could you comment on the following type declarations?
- getArgs :: IO [String]
It can get several params, but its type declaration looks like it gets
none.
- dispatch :: [(String, [String] -> IO ())] [1]
I don't know how to read this one. It looks bizarre.
[1] http://learnyouahaskell.com/input-and-output#files-and-streams
------------------------------
Message: 2
Date: Fri, 5 Oct 2012 20:06:24 -0400
From: brandon s allbery kf8nh <[email protected]>
Subject: Re: [Haskell-beginners] Questions on type declarations
To: [email protected]
Cc: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset="utf-8"
On Friday, 5 October 2012 at 19:55, [email protected] wrote:
> - getArgs :: IO [String]
>
> It can get several params, but its type declaration looks like it gets
> none.
>
>
It doesn't get any Haskell parameters; it retrieves OS-level (not
Haskell-level) parameters to the program. If you know Perl, it's the
difference between @_ and @ARGV; if Python, the difference between local
parameters and sys.argv. You might infer from the fact that other languages
also distinguish, that there is an actual difference between function
parameters and program parameters; if you are not clear on this, you will need
to figure it out regardless of the language you're working with.
> - dispatch :: [(String, [String] -> IO ())]
Looks to me like it's described fairly well by the text. What is your
confusion?
It is an association list: a list of pairs, the first element being a key and
the second being a value. The value in this case is a function which takes a
list of strings and produces an IO action.
--
brandon s allbery kf8nh sine nomine associates
[email protected] [email protected]
unix/linux, openafs, kerberos, infrastructure http://sinenomine.net
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20121005/0c1ac587/attachment-0001.htm>
------------------------------
_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners
End of Beginners Digest, Vol 52, Issue 7
****************************************