Send Beginners mailing list submissions to beginners@haskell.org 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 beginners-requ...@haskell.org
You can reach the person managing the list at beginners-ow...@haskell.org When replying, please edit your Subject line so it is more specific than "Re: Contents of Beginners digest..." Today's Topics: 1. Re: Errors while compiling webkit (Lorenzo Bolla) 2. Concatenating lists (Jan Erik Mostr?m) 3. Re: Concatenating lists (Lorenzo Bolla) 4. Re: Concatenating lists (Antoine Latter) 5. Re: Concatenating lists (Felipe Almeida Lessa) 6. Re: Concatenating lists (Jan Erik Mostr?m) 7. Re: Concatenating lists (Thomas Davie) ---------------------------------------------------------------------- Message: 1 Date: Thu, 22 Mar 2012 14:04:59 +0000 From: Lorenzo Bolla <lbo...@gmail.com> Subject: Re: [Haskell-beginners] Errors while compiling webkit Cc: beginners@haskell.org Message-ID: <cadjgtrxr1xa4vgm2g5n81vjuehrmcav2i2l1nt1n85ceibx...@mail.gmail.com> Content-Type: text/plain; charset="utf-8" Thanks, it worked. L. On Tue, Mar 20, 2012 at 7:12 PM, Dino Morelli <d...@ui3.info> wrote: > Lorenzo Bolla <lbolla <at> gmail.com> writes: > > > Hi all, > > > > I'm trying to compile Haskell's webkit package, but I'm getting this > error: > > > > > > $ cabal install webkit > > Resolving dependencies... > > [1 of 2] Compiling SetupWrapper ( /tmp/webkit-0.12.3-9205/webkit- > 0.12.3/SetupWrapper.hs, /tmp/webkit-0.12.3-9205/webkit- > 0.12.3/dist/setup/SetupWrapper.o ) > > [2 of 2] Compiling Main ( /tmp/webkit-0.12.3-9205/webkit- > 0.12.3/Setup.hs, /tmp/webkit-0.12.3-9205/webkit-0.12.3/dist/setup/Main.o ) > > Linking /tmp/webkit-0.12.3-9205/webkit-0.12.3/dist/setup/setup ... > > [1 of 2] Compiling Gtk2HsSetup ( Gtk2HsSetup.hs, dist/setup- > wrapper/Gtk2HsSetup.o ) > > [2 of 2] Compiling Main ( SetupMain.hs, > dist/setup-wrapper/Main.o > ) > > Linking dist/setup-wrapper/setup ... > > Configuring webkit-0.12.3... > > Building webkit-0.12.3... > > Preprocessing library webkit-0.12.3... > > dist/build/Graphics/UI/Gtk/WebKit/Types.h:1:22: fatal error: hswebkit.h: > No > such file or directory > > compilation terminated. > > gtk2hsC2hs: Error during preprocessing custom header file > > cabal: Error: some packages failed to install: > > webkit-0.12.3 failed during the building phase. The exception was: > > ExitFailure 1 > > > > > > I'm compiling it inside a hsenv, with this ghc: > > > > $ ghc -v > > Glasgow Haskell Compiler, Version 7.4.1, stage 2 booted by GHC version > 7.4.1 > > > > Using binary package database: > /tmp/webkit/.hsenv/ghc_pkg_db/package.cache > > wired-in package ghc-prim mapped to ghc-prim-0.2.0.0- > c2ff696e5b8ec4d4b2bc2e42085fe471 > > wired-in package integer-gmp mapped to integer-gmp-0.4.0.0- > 3cccac07aef8e27023f605c1f45bdf74 > > wired-in package base mapped to > base-4.5.0.0-40b99d05fae6a4eea95ea69e6e0c9702 > > wired-in package rts mapped to builtin_rts > > wired-in package template-haskell mapped to template-haskell-2.7.0.0- > 8c8cd20e21666657195efabced685fe1 > > wired-in package dph-seq not found. > > wired-in package dph-par not found. > > Hsc static flags: -static > > > > > > Any ideas? > > > > Thanks, > > L. > > > > By complete chance, I happened to be trying to use webkit today as well, > ran into the same problem. > > Looks like hswebkit.h isn't getting installed anywhere in an include > dir on my system. I was able to install and build against the webkit > library > after copying that file manually myself from the root of the webkit dev dir > to /usr/local/include > > You can get the webkit source to get this .h file: > > $ darcs get http://code.haskell.org/webkit/ > > > This is of course not a good long-term solution. I'm trying to figure out > whom to email or where to send a bug report now. > > > -- > Dino Morelli email: d...@ui3.info web: http://ui3.info/d/ > pubkey: http://ui3.info/d/dino-4AA4F02D-pub.gpg > > > > _______________________________________________ > Beginners mailing list > Beginners@haskell.org > http://www.haskell.org/mailman/listinfo/beginners > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://www.haskell.org/pipermail/beginners/attachments/20120322/6146f7aa/attachment-0001.htm> ------------------------------ Message: 2 Date: Thu, 22 Mar 2012 15:44:21 +0100 From: Jan Erik Mostr?m <li...@mostrom.pp.se> Subject: [Haskell-beginners] Concatenating lists To: beginners@haskell.org Message-ID: <8f4a53ab7c44470d906959f0913fe...@jemostrom.com> Content-Type: text/plain; charset="utf-8" Hi, I've just started to learn Haskell and played around a bit and tried this 1: let x = [1,2,3] 2: let x = x ++ [4,5,6] 3: x The last line doesn't give a result. I assume that this is because 'x' is a name of a value, in the second line I redefine 'x' to a new value but Haskell doesn't evaluate the value until the last line but then 'x' becomes recursively defined in itself (the second x on line 2 is interpreted to refer to the value of the first x on line 2 and not the value defined in line 1). This behavior is caused by the lazy evaluation in Haskell. Have I understood this correctly? - jem ------------------------------ Message: 3 Date: Thu, 22 Mar 2012 15:05:43 +0000 From: Lorenzo Bolla <lbo...@gmail.com> Subject: Re: [Haskell-beginners] Concatenating lists To: Jan Erik Mostr?m <li...@mostrom.pp.se> Cc: beginners@haskell.org Message-ID: <CADjgTRwEbF2SoMtXEwd=0OThWxCXo6wWk=8no79-adoyfh0...@mail.gmail.com> Content-Type: text/plain; charset="utf-8" On Thu, Mar 22, 2012 at 2:44 PM, Jan Erik Mostr?m <li...@mostrom.pp.se>wrote: > Hi, > > I've just started to learn Haskell and played around a bit and tried this > > 1: let x = [1,2,3] > 2: let x = x ++ [4,5,6] > 3: x > > The last line doesn't give a result. I assume that this is because 'x' is > a name of a value, in the second line I redefine 'x' to a new value but > Haskell doesn't evaluate the value until the last line but then 'x' becomes > recursively defined in itself (the second x on line 2 is interpreted to > refer to the value of the first x on line 2 and not the value defined in > line 1). This behavior is caused by the lazy evaluation in Haskell. > > Have I understood this correctly? > Yes. > > - jem > > > > _______________________________________________ > Beginners mailing list > Beginners@haskell.org > http://www.haskell.org/mailman/listinfo/beginners > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://www.haskell.org/pipermail/beginners/attachments/20120322/63bb1e37/attachment-0001.htm> ------------------------------ Message: 4 Date: Thu, 22 Mar 2012 10:05:25 -0500 From: Antoine Latter <aslat...@gmail.com> Subject: Re: [Haskell-beginners] Concatenating lists To: Jan Erik Mostr?m <li...@mostrom.pp.se> Cc: beginners@haskell.org Message-ID: <cakjsnqe6sdyxy3vc9espspj6uvn-han4nm-s2vodfcbj42h...@mail.gmail.com> Content-Type: text/plain; charset=UTF-8 On Thu, Mar 22, 2012 at 9:44 AM, Jan Erik Mostr?m <li...@mostrom.pp.se> wrote: > Hi, > > I've just started to learn Haskell and played around a bit and tried this > > 1: let x = [1,2,3] > 2: let x = x ++ [4,5,6] > 3: x > > The last line doesn't give a result. I assume that this is because 'x' is a > name of a value, in the second line I redefine 'x' to a new value but Haskell > doesn't evaluate the value until the last line but then 'x' becomes > recursively defined in itself (the second x on line 2 is interpreted to refer > to the value of the first x on line 2 and ?not the value defined in line 1). > This behavior is caused by the lazy evaluation in Haskell. > > Have I understood this correctly? > Yeah, that sounds right. Antoine ------------------------------ Message: 5 Date: Thu, 22 Mar 2012 12:12:03 -0300 From: Felipe Almeida Lessa <felipe.le...@gmail.com> Subject: Re: [Haskell-beginners] Concatenating lists To: Jan Erik Mostr?m <li...@mostrom.pp.se> Cc: beginners@haskell.org Message-ID: <CANd=OGGw-9kK2o=7i8b1baELLd6=fouqka1qcc-r2uvrtfe...@mail.gmail.com> Content-Type: text/plain; charset=UTF-8 On Thu, Mar 22, 2012 at 11:44 AM, Jan Erik Mostr?m <li...@mostrom.pp.se> wrote: > Hi, > > I've just started to learn Haskell and played around a bit and tried this > > 1: let x = [1,2,3] > 2: let x = x ++ [4,5,6] > 3: x > > The last line doesn't give a result. I assume that this is because 'x' is a > name of a value, in the second line I redefine 'x' to a new value but Haskell > doesn't evaluate the value until the last line but then 'x' becomes > recursively defined in itself (the second x on line 2 is interpreted to refer > to the value of the first x on line 2 and ?not the value defined in line 1). > This behavior is caused by the lazy evaluation in Haskell. > > Have I understood this correctly? Your conclusion is correct, but your reasoning is not. It's not due to lazyness that x is recursively defined, it's because of the scope. When you type your second x on the second line, that x will refer to the closest (in scope) definition of something called x -- which is the the definition of x on the second line itself. Cheers, -- Felipe. ------------------------------ Message: 6 Date: Thu, 22 Mar 2012 16:54:58 +0100 From: Jan Erik Mostr?m <li...@mostrom.pp.se> Subject: Re: [Haskell-beginners] Concatenating lists To: Felipe Almeida Lessa <felipe.le...@gmail.com> Cc: beginners@haskell.org Message-ID: <f3fc8a15dd6a4b409d9d8a6759402...@jemostrom.com> Content-Type: text/plain; charset="utf-8" On 2012-03-22 at 16:12 , Felipe Almeida Lessa wrote: > Your conclusion is correct, but your reasoning is not. It's not due > to lazyness that x is recursively defined, it's because of the scope. > When you type your second x on the second line, that x will refer to > the closest (in scope) definition of something called x -- which is > the the definition of x on the second line itself. Aha, thanks for explaining. I didn't consider scope - I did some searching of scoping and need to think about that for a while, a bit different than 'normal'. However, I would like to ask one more thing: Assume let a = 5 + 3 Would 5+3 be calculated directly or would it be deferred to later? Assume it's calculated and the value 8 is given the name 'a'. Then let a = a + 4 What happens is that Haskell tries to evaluate the second 'a' on that line and then finds the first 'a' and enters into infinite recursion. And this is what confuses me a little bit. I can type in 'let a = a + 4' and Haskell accepts it, the infinite recursion does not happen until I type 'a' to show the value, this makes me think that the evaluation is deferred to later (and also why I asked about 5+3). Is this correct? - jem ------------------------------ Message: 7 Date: Thu, 22 Mar 2012 16:11:43 +0000 From: Thomas Davie <tom.da...@gmail.com> Subject: Re: [Haskell-beginners] Concatenating lists To: Jan Erik Mostr?m <li...@mostrom.pp.se> Cc: beginners@haskell.org Message-ID: <c657dfae-3eaf-4d20-b2bc-0ad30ea7e...@gmail.com> Content-Type: text/plain; charset="windows-1252" The logical issue you're hitting is mostly because the REPL (ghci most likely) is simulating something that you should ignore for the moment (the IO monad). In Haskell, typically, you don't define one thing, then define another thing "later". A definition in a Haskell program doesn't assign a value, it binds a value. While assignment says "a now has the value 5 + 3", binding says "a always has, now has, and always will have the value 5+3". A Haskell program like this that binds the same value twice is simply incorrect: a = 5+3 a = 5+4 There are two competing facts here. When typing into the REPL, you can rebind values, because each subsequent line appears (at least in the logical model) in an inner definition to the past. This is how scoping comes into it ? the later (and hence inner) let takes precedence because it is in a closer scope. My advice to you would be to stop thinking of trying to re-assign values right now, it's not the correct way to think about a Haskell program at all. Bob if (*ra4 != 0xffc78948) { return false; } On 22 Mar 2012, at 15:54, Jan Erik Mostr?m wrote: > On 2012-03-22 at 16:12 , Felipe Almeida Lessa wrote: >> Your conclusion is correct, but your reasoning is not. It's not due >> to lazyness that x is recursively defined, it's because of the scope. >> When you type your second x on the second line, that x will refer to >> the closest (in scope) definition of something called x -- which is >> the the definition of x on the second line itself. > > Aha, thanks for explaining. I didn't consider scope - I did some searching of > scoping and need to think about that for a while, a bit different than > 'normal'. However, I would like to ask one more thing: > > Assume > > let a = 5 + 3 > > Would 5+3 be calculated directly or would it be deferred to later? > Assume it's calculated and the value 8 is given the name 'a'. Then > > let a = a + 4 > > What happens is that Haskell tries to evaluate the second 'a' on that line > and then finds the first 'a' and enters into infinite recursion. > > And this is what confuses me a little bit. I can type in 'let a = a + 4' and > Haskell accepts it, the infinite recursion does not happen until I type 'a' > to show the value, this makes me think that the evaluation is deferred to > later (and also why I asked about 5+3). Is this correct? > > - jem > > _______________________________________________ > Beginners mailing list > Beginners@haskell.org > http://www.haskell.org/mailman/listinfo/beginners -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://www.haskell.org/pipermail/beginners/attachments/20120322/f523ae24/attachment.htm> ------------------------------ _______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners End of Beginners Digest, Vol 45, Issue 28 *****************************************