[Haskell-cafe] 'let' keyword optional in do notation?

2012-08-08 Thread Martijn Schrage
Hi cafe, For a while now, I've been wondering why the 'let' keyword in a do block isn't optional. So instead of do ... let x = exp1 y = exp2 z - exp3 ... you could simply write do ... x = exp1 y = exp2 z - exp3 ... Where each sequence of let-less bindings is put

Re: [Haskell-cafe] 'let' keyword optional in do notation?

2012-08-08 Thread Vo Minh Thu
2012/8/8 Martijn Schrage mart...@oblomov.com: Hi cafe, For a while now, I've been wondering why the 'let' keyword in a do block isn't optional. So instead of do ... let x = exp1 y = exp2 z - exp3 ... you could simply write do ... x = exp1 y = exp2 z - exp3

Re: [Haskell-cafe] 'let' keyword optional in do notation?

2012-08-08 Thread Ertugrul Söylemez
Vo Minh Thu not...@gmail.com wrote: This is not a parsing problem, but a scoping one: try to run this program: main = do let x = y y = 5 let a = b let b = 6 print (x, y, a, b) Cheers, Thu Martijn has actually covered this question: Where each sequence of let-less

Re: [Haskell-cafe] 'let' keyword optional in do notation?

2012-08-08 Thread Martijn Schrage
On 08-08-12 17:27, Ertugrul Söylemez wrote: Vo Minh Thu not...@gmail.com wrote: This is not a parsing problem, but a scoping one: try to run this program: main = do let x = y y = 5 let a = b let b = 6 print (x, y, a, b) Cheers, Thu Martijn has actually covered this

[Haskell-cafe] Fwd: 'let' keyword optional in do notation?

2012-08-08 Thread David Feuer
-- Forwarded message -- From: David Feuer david.fe...@gmail.com Date: Wed, Aug 8, 2012 at 12:22 PM Subject: Re: [Haskell-cafe] 'let' keyword optional in do notation? To: Martijn Schrage mart...@oblomov.com Changing scoping rules based on whether things are right next to each

[Haskell-cafe] 3 level hierarchy of Haskell objects

2012-08-08 Thread Patrick Browne
Gast [1] describes a 3 level hierarchy of Haskell objects using elementOf from set theory:value  *elementOf*  type  *elementOf*  classQuestionIf we include super-classes would the following be an appropriate mathematical representation?value *elementOf*  type  *elementOf* class  *subSet*

Re: [Haskell-cafe] Fwd: 'let' keyword optional in do notation?

2012-08-08 Thread Simon Hengel
On Wed, Aug 08, 2012 at 12:22:39PM -0400, David Feuer wrote: Changing scoping rules based on whether things are right next to each other? No thanks. Would expanding each let-less binding to a separate let feel more sound to you? Cheers, Simon ___

Re: [Haskell-cafe] 3 level hierarchy of Haskell objects

2012-08-08 Thread Ertugrul Söylemez
Patrick Browne patrick.bro...@dit.ie wrote: Gast [1] describes a 3 level hierarchy of Haskell objects using elementOf from set theory: value  *elementOf*  type  *elementOf*  class This hierarchy is pretty arbitrary and quickly runs into problems with some type system extensions. You can

Re: [Haskell-cafe] Fwd: 'let' keyword optional in do notation?

2012-08-08 Thread Martijn Schrage
On 08-08-12 19:01, Simon Hengel wrote: On Wed, Aug 08, 2012 at 12:22:39PM -0400, David Feuer wrote: Changing scoping rules based on whether things are right next to each other? No thanks. Would expanding each let-less binding to a separate let feel more sound to you? That was actually my

Re: [Haskell-cafe] 3 level hierarchy of Haskell objects

2012-08-08 Thread Patrick Browne
On 08/08/12, Ertugrul Söylemez e...@ertes.de wrote: If we include super-classes would the following be an appropriate mathematical representation?What is a superclass?  What are the semantics?I assume that like a normal class a super-class *defines* a set operations for types, but it is not *a

Re: [Haskell-cafe] Fwd: 'let' keyword optional in do notation?

2012-08-08 Thread David Feuer
Is it really so bad to use an explicit let when you need mutually recursive bindings? On Aug 8, 2012 1:51 PM, Martijn Schrage mart...@oblomov.com wrote: On 08-08-12 19:01, Simon Hengel wrote: On Wed, Aug 08, 2012 at 12:22:39PM -0400, David Feuer wrote: Changing scoping rules based on

Re: [Haskell-cafe] 3 level hierarchy of Haskell objects

2012-08-08 Thread Ertugrul Söylemez
Patrick Browne patrick.bro...@dit.ie wrote: If we include super-classes would the following be an appropriate mathematical representation? What is a superclass?  What are the semantics? I assume that like a normal class a super-class *defines* a set operations for types, but it is

[Haskell-cafe] parsec: parserFail multiple error messages

2012-08-08 Thread silly8888
I am trying to create a parsec parser that parses an integer and then checks if that integer has the right size. If not, it generates an error. I tried the following: 8--- import Text.Parsec import Text.Parsec.String integer :: Parser

Re: [Haskell-cafe] 3 level hierarchy of Haskell objects

2012-08-08 Thread Patrick Browne
On 08/08/12, Ertugrul Söylemez e...@ertes.de wrote:So you basically just mean    class (Functor f) = Applicative fYes, but I want to know if there is a simple mathematical relation between the classes and/or  their typesBut from your emails the original hierarchy seems to have been superseded,

Re: [Haskell-cafe] parsec: parserFail multiple error messages

2012-08-08 Thread Nick Vanderweit
I found a similar question asked in June 2009 on the haskell-beginners archives, titled Clearing Parsec error messages. A hack that was proposed (http://www.haskell.org/pipermail/beginners/2009-June/001809.html) was to insert a dummy character into the stream, consume it, and then fail. Still,

[Haskell-cafe] foreign import and gmp

2012-08-08 Thread Lars Kuhtz
Hi all, There have been rumors that recent versions of GHC may allow foreign imports of objects that link against gmp without interfering with the gmp imports in integer-gmp. What is the current state of that issue? What is the currently recommended way to deal with that problem? Thanks, Lars

Re: [Haskell-cafe] foreign import and gmp

2012-08-08 Thread Thomas DuBuisson
You need to build GHC using the integer-simple library (instead of the 'integer-gmp' library). From the 6.12.1 release notes: It is now possible to build GHC with a simple, BSD-licensed Haskell implementation of Integer, instead of the implementation on top of GMP. To do so, set INTEGER_LIBRARY

Re: [Haskell-cafe] foreign import and gmp

2012-08-08 Thread Lars Kuhtz
On 8/8/12 2:55 PM, Thomas DuBuisson wrote: You need to build GHC using the integer-simple library (instead of the 'integer-gmp' library). From the 6.12.1 release notes: It is now possible to build GHC with a simple, BSD-licensed Haskell implementation of Integer, instead of the

Re: [Haskell-cafe] foreign import and gmp

2012-08-08 Thread Thomas DuBuisson
On Wed, Aug 8, 2012 at 3:24 PM, Lars Kuhtz hask...@kuhtz.eu wrote: On 8/8/12 2:55 PM, Thomas DuBuisson wrote: You need to build GHC using the integer-simple library (instead of the 'integer-gmp' library). From the 6.12.1 release notes: It is now possible to build GHC with a simple,

Re: [Haskell-cafe] 3 level hierarchy of Haskell objects

2012-08-08 Thread wren ng thornton
On 8/8/12 3:36 PM, Patrick Browne wrote: On 08/08/12, *Ertugrul Söylemez *e...@ertes.de wrote: So you basically just mean class (Functor f) = Applicative f Yes, but I want to know if there is a simple mathematical relation between the classes and/or their types Let us introduce

Re: [Haskell-cafe] 3 level hierarchy of Haskell objects

2012-08-08 Thread Richard O'Keefe
On 9/08/2012, at 11:11 AM, wren ng thornton wrote: Notably, a type class instantiated with all its arguments is not itself a type! All the comparisons of Haskell typeclasses with Java classes answered in one brief lucid sentence. ___

[Haskell-cafe] Haskell Weekly News: Issue 239

2012-08-08 Thread Daniel Santa Cruz
Welcome to issue 239 of the HWN, an issue covering crowd-sourced bits of information about Haskell from around the web. This issue covers the week of July 29 to August 4, 2012. Quotes of the Week * romm: i thought i knew programming. this is like discovering a new continent. *

Re: [Haskell-cafe] parsec: parserFail multiple error messages

2012-08-08 Thread silly8888
Inserting a character into the stream can be expensive if for example the stream is a ByteString. I tried the following crazy solution and it seems that it works: succeed :: Parser () succeed = mkPT $ \st - return $ Consumed $ return $ Ok () st $ unknownError st succeed is a parser that

Re: [Haskell-cafe] 3 level hierarchy of Haskell objects

2012-08-08 Thread Jay Sulzberger
On Wed, 8 Aug 2012, Ertugrul S??ylemez e...@ertes.de wrote: Patrick Browne patrick.bro...@dit.ie wrote: Gast [1] describes a 3 level hierarchy of Haskell objects using elementOf from set theory: value?? *elementOf*?? type?? *elementOf*?? class This hierarchy is pretty arbitrary and

Re: [Haskell-cafe] parsec: parserFail multiple error messages

2012-08-08 Thread Antoine Latter
On Wed, Aug 8, 2012 at 8:26 PM, silly silly8...@gmail.com wrote: Inserting a character into the stream can be expensive if for example the stream is a ByteString. I tried the following crazy solution and it seems that it works: succeed :: Parser () succeed = mkPT $ \st - return $

[Haskell-cafe] mutable arrays of tuples

2012-08-08 Thread David Feuer
So I was thinking about a mutable array of tuples, but to avoid allocating tuples to modify their fields, I guess I really want an immutable array of tuples of STRefs. Just how much less efficient is this than a plain mutable array? might it even make sense to use parallel mutable arrays? The