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: question on layout (Magnus Therning)
2. Cabal not detecting foreign libraries (aditya siram)
3. Re: Cabal not detecting foreign libraries (Daniel Fischer)
4. Re: Cabal not detecting foreign libraries (Brent Yorgey)
5. xml parsing (Benedikt Ahrens)
6. map increases length of list (Aaron MacDonald)
7. Re: map increases length of list (Henk-Jan van Tuyl)
8. Re: map increases length of list (Michael Snoyman)
9. Re: map increases length of list (Aaron MacDonald)
10. Re: map increases length of list (Alan Mock)
----------------------------------------------------------------------
Message: 1
Date: Wed, 17 Jun 2009 09:19:38 +0100
From: Magnus Therning <[email protected]>
Subject: Re: [Haskell-beginners] question on layout
To: George Huber <[email protected]>
Cc: [email protected]
Message-ID:
<[email protected]>
Content-Type: text/plain; charset=UTF-8
On Wed, Jun 17, 2009 at 12:41 AM, George Huber<[email protected]> wrote:
> (1) what was the driving force behind using white-space to denote code
> blocks? Â From a beginners perspective (especially coming from a strong C /
> C++ background) this seems to add to the learning curve for the language,
> and can add a good deal of frustration.
I only really know two languages that use significant whitespace in
this way, Python and Haskell. I learnt Python first, and had
basically the same thoughts as you do. It felt weird, even though I
always made sure to indent my C/C++ code to make it more readable. It
took some time, but by now I love it, and consider it a positive point
of both languages. IMO the people behind Haskell had a better
understanding of the off-side rule though, so there are less
strangeness in Haskell indentation. By now I find that my indentation
practices are leaking into other languages, e.g. from a distance my
OCaml code looks similar to my Haskell code.
You may be right that it adds to the learning curve, but I consider it
well worth it in the long run.
/M
--
Magnus Therning (OpenPGP: 0xAB4DFBA4)
magnusï¼ therningï¼org Jabber: magnusï¼ therningï¼org
http://therning.org/magnus identi.ca|twitter: magthe
------------------------------
Message: 2
Date: Wed, 17 Jun 2009 11:13:06 -0500
From: aditya siram <[email protected]>
Subject: [Haskell-beginners] Cabal not detecting foreign libraries
To: beginners <[email protected]>
Message-ID:
<[email protected]>
Content-Type: text/plain; charset="iso-8859-1"
Hi all,
I am trying to install vacuum-cairo and leksah. For both these packages
cabal complains that "gtk", "gtksourceview", "svgcairo" etc are not found.
They are definetely installed on my Ubuntu Hardy Heron box. Where is Cabal
looking?
thanks ...
-deech
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://www.haskell.org/pipermail/beginners/attachments/20090617/60f2523d/attachment-0001.html
------------------------------
Message: 3
Date: Wed, 17 Jun 2009 18:40:33 +0200
From: Daniel Fischer <[email protected]>
Subject: Re: [Haskell-beginners] Cabal not detecting foreign libraries
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset="iso-8859-15"
Am Mittwoch 17 Juni 2009 18:13:06 schrieb aditya siram:
> Hi all,
> I am trying to install vacuum-cairo and leksah. For both these packages
> cabal complains that "gtk", "gtksourceview", "svgcairo" etc are not found.
> They are definetely installed on my Ubuntu Hardy Heron box. Where is Cabal
> looking?
>
> thanks ...
> -deech
What's the exact error message?
These are all subpackages of gtk2hs, so doesn't cabal find the haskell packages
of these
names or the C(++) libraries?
I f the haskell packages are not found, that means you haven't installed gtk2hs
for your
most recent ghc.
------------------------------
Message: 4
Date: Wed, 17 Jun 2009 13:52:50 -0400
From: Brent Yorgey <[email protected]>
Subject: Re: [Haskell-beginners] Cabal not detecting foreign libraries
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=us-ascii
On Wed, Jun 17, 2009 at 11:13:06AM -0500, aditya siram wrote:
> Hi all,
> I am trying to install vacuum-cairo and leksah. For both these packages
> cabal complains that "gtk", "gtksourceview", "svgcairo" etc are not found.
> They are definetely installed on my Ubuntu Hardy Heron box. Where is Cabal
> looking?
When you say "they are definitely installed", what do you mean? If
you mean you have installed Ubuntu packages like libgtk-dev (or
whatever it is called), that's good, but not enough. Cabal is looking
for *Haskell* libraries which contain the bindings to those foreign
libraries. You will have to install gtk2hs, which provides them:
http://www.haskell.org/gtk2hs/
-Brent
------------------------------
Message: 5
Date: Wed, 17 Jun 2009 20:05:39 +0200
From: Benedikt Ahrens <[email protected]>
Subject: [Haskell-beginners] xml parsing
To: [email protected]
Message-ID:
<[email protected]>
Content-Type: text/plain; charset=UTF-8
Hello,
I want to write a program which among other should read some xml file.
The xml tags will mostly be custom ones defined by a dtd.
My question is: which parsing library to use?
On
http://en.wikibooks.org/wiki/Haskell/XML
three libraries are mentioned, but a comparison and recommendation of
which one to choose is missing.
As you might imagine, I would like to use a library which is actively
maintained? Has any of these libraries developed into a "standard"
library?
Thanks in advance for your help.
ben
------------------------------
Message: 6
Date: Wed, 17 Jun 2009 18:35:23 -0300
From: Aaron MacDonald <[email protected]>
Subject: [Haskell-beginners] map increases length of list
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes
For some reason, the map function returns a list that has one more
element than my input list.
My input list is a range defined by [0, 60..359] (should translate
into [0,60,120,180,240,300]).
The function I'm giving to map is defined this way:
-----
degreesToRadians :: Double -> Double
degreesToRadians degrees = degrees * (pi / 180)
-----
This is how I'm calling map overall:
-----
> map degreesToRadians [0,60..359]
[0.0,1.0471975511965976,2.0943951023931953,3.141592653589793,4.1887902047863905,5.235987755982989,6.283185307179586
]
-----
As you can hopefully see, there are seven elements instead of six.
Getting the length confirms this:
-----
> length [0,60..359]
6
> length $ map degreesToRadians [0,60..359]
7
-----
I do not seem to get this behaviour with the length if I either
substitute the degreesToRadians function or substitute the [0,60..359]
range.
P.S. Is there a built-in function to convert degrees to radians and
vice-versa?
------------------------------
Message: 7
Date: Wed, 17 Jun 2009 23:58:52 +0200
From: "Henk-Jan van Tuyl" <[email protected]>
Subject: Re: [Haskell-beginners] map increases length of list
To: "Aaron MacDonald" <[email protected]>, [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; format=flowed; delsp=yes;
charset=iso-8859-15
On Wed, 17 Jun 2009 23:35:23 +0200, Aaron MacDonald <[email protected]>
wrote:
>
> This is how I'm calling map overall:
> -----
> > map degreesToRadians [0,60..359]
> [0.0,1.0471975511965976,2.0943951023931953,3.141592653589793,4.1887902047863905,5.235987755982989,6.283185307179586
>
> ]
> -----
>
> As you can hopefully see, there are seven elements instead of six.
> Getting the length confirms this:
> -----
> > length [0,60..359]
> 6
> > length $ map degreesToRadians [0,60..359]
> 7
> -----
Enumeration works differently for Double:
Prelude> [0, 60..359 :: Double]
[0.0,60.0,120.0,180.0,240.0,300.0,360.0]
Prelude> length [0, 60..359 :: Double]
7
--
Met vriendelijke groet,
Henk-Jan van Tuyl
--
http://functor.bamikanarie.com
http://Van.Tuyl.eu/
--
------------------------------
Message: 8
Date: Thu, 18 Jun 2009 01:02:59 +0300
From: Michael Snoyman <[email protected]>
Subject: Re: [Haskell-beginners] map increases length of list
To: Aaron MacDonald <[email protected]>
Cc: [email protected]
Message-ID:
<[email protected]>
Content-Type: text/plain; charset="utf-8"
Aaron,
Look at the following snippet:
> length ([0,60..359] :: [Double])
7
Basically, the Enum instance for Double is done differently than for Int (I
don't remember why exactly). If you take off the type signature, it uses Int
by default. When you use map, it implicitly converts that to a Double.
Hope that helps.
Michael
On Thu, Jun 18, 2009 at 12:35 AM, Aaron MacDonald <[email protected]>wrote:
> For some reason, the map function returns a list that has one more element
> than my input list.
>
> My input list is a range defined by [0, 60..359] (should translate into
> [0,60,120,180,240,300]).
>
> The function I'm giving to map is defined this way:
> -----
> degreesToRadians :: Double -> Double
> degreesToRadians degrees = degrees * (pi / 180)
> -----
>
> This is how I'm calling map overall:
> -----
> > map degreesToRadians [0,60..359]
>
> [0.0,1.0471975511965976,2.0943951023931953,3.141592653589793,4.1887902047863905,5.235987755982989,6.283185307179586]
> -----
>
> As you can hopefully see, there are seven elements instead of six. Getting
> the length confirms this:
> -----
> > length [0,60..359]
> 6
> > length $ map degreesToRadians [0,60..359]
> 7
> -----
>
> I do not seem to get this behaviour with the length if I either substitute
> the degreesToRadians function or substitute the [0,60..359] range.
>
> P.S. Is there a built-in function to convert degrees to radians and
> vice-versa?
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://www.haskell.org/pipermail/beginners/attachments/20090617/cc915786/attachment-0001.html
------------------------------
Message: 9
Date: Wed, 17 Jun 2009 20:33:37 -0300
From: Aaron MacDonald <[email protected]>
Subject: Re: [Haskell-beginners] map increases length of list
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes
Sigh.
Well, what I was trying to do was get all angles in the range [0, 360)
that have 60 degrees between them, since I'm going to be working with
hexagons. I figured I'd use a range instead of hard-coded angles in
case I wanted to use other shapes.
Thanks,
Aaron
On 17-Jun-09, at 6:58 PM, Henk-Jan van Tuyl wrote:
> On Wed, 17 Jun 2009 23:35:23 +0200, Aaron MacDonald <[email protected]
> > wrote:
>
>>
>> This is how I'm calling map overall:
>> -----
>> > map degreesToRadians [0,60..359]
>> [0.0,1.0471975511965976,2.0943951023931953,3.141592653589793,4.1887902047863905,5.235987755982989,6.283185307179586
>>
>> ]
>> -----
>>
>> As you can hopefully see, there are seven elements instead of six.
>> Getting the length confirms this:
>> -----
>> > length [0,60..359]
>> 6
>> > length $ map degreesToRadians [0,60..359]
>> 7
>> -----
>
> Enumeration works differently for Double:
> Prelude> [0, 60..359 :: Double]
> [0.0,60.0,120.0,180.0,240.0,300.0,360.0]
> Prelude> length [0, 60..359 :: Double]
> 7
>
>
> --
> Met vriendelijke groet,
> Henk-Jan van Tuyl
>
>
> --
> http://functor.bamikanarie.com
> http://Van.Tuyl.eu/
> --
>
>
------------------------------
Message: 10
Date: Wed, 17 Jun 2009 16:55:36 -0500
From: Alan Mock <[email protected]>
Subject: Re: [Haskell-beginners] map increases length of list
To: Aaron MacDonald <[email protected]>
Cc: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes
That's because [0,60,..359] is not the same as [0,60..359] ::
[Double]. So what you're passing to degreesToRadians is
[0.0,60.0,120.0,180.0,240.0,300.0,360.0] and not
[0,60,120,180,240,300]. I don't know why the Double version adds
another number, though.
On Jun 17, 2009, at 4:35 PM, Aaron MacDonald wrote:
> For some reason, the map function returns a list that has one more
> element than my input list.
>
> My input list is a range defined by [0, 60..359] (should translate
> into [0,60,120,180,240,300]).
>
> The function I'm giving to map is defined this way:
> -----
> degreesToRadians :: Double -> Double
> degreesToRadians degrees = degrees * (pi / 180)
> -----
>
> This is how I'm calling map overall:
> -----
> > map degreesToRadians [0,60..359]
> [0.0,1.0471975511965976,2.0943951023931953,3.141592653589793,4.1887902047863905,5.235987755982989,6.283185307179586
>
> ]
> -----
>
> As you can hopefully see, there are seven elements instead of six.
> Getting the length confirms this:
> -----
> > length [0,60..359]
> 6
> > length $ map degreesToRadians [0,60..359]
> 7
> -----
>
> I do not seem to get this behaviour with the length if I either
> substitute the degreesToRadians function or substitute the
> [0,60..359] range.
>
> P.S. Is there a built-in function to convert degrees to radians and
> vice-versa?
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
------------------------------
_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners
End of Beginners Digest, Vol 12, Issue 7
****************************************