Re: [Haskell-cafe] Positive integers

2006-03-24 Thread Malcolm Wallace
Daniel McAllansmith [EMAIL PROTECTED] wrote: Unless I've missed it, there is no typeclass for positive integers in GHC. Is there any particular reason it doesn't exist? Also, it seems Word would be a far better type in the likes of (!!), length, etc. Is it just tradition that resulted in

Re: [Haskell-cafe] Positive integers

2006-03-24 Thread Henning Thielemann
On Fri, 24 Mar 2006, Malcolm Wallace wrote: Daniel McAllansmith [EMAIL PROTECTED] wrote: Unless I've missed it, there is no typeclass for positive integers in GHC. Is there any particular reason it doesn't exist? Also, it seems Word would be a far better type in the likes of (!!), length,

[Haskell-cafe] Re: Reading files efficiently

2006-03-24 Thread Pete Chown
Simon Marlow wrote: GHC 6.6 will allow this, because we added the -x flag (works just like gcc's -x flag). eg. ghc -x hs foo.wibble will interpret foo.wibble as a .hs file. I have an uncommitted patch for runghc that uses -x, I need to test commit it. Ah, that will be very useful,

[Haskell-cafe] Re: Positive integers

2006-03-24 Thread Henning Thielemann
On Fri, 24 Mar 2006, Aaron Denney wrote: On 2006-03-24, Daniel McAllansmith [EMAIL PROTECTED] wrote: Unless I've missed it, there is no typeclass for positive integers in GHC. Is there any particular reason it doesn't exist? The number of useable operations is small, and checks for leaving

Re: [Haskell-cafe] Re: Positive integers

2006-03-24 Thread Bulat Ziganshin
Hello Henning, Friday, March 24, 2006, 3:55:55 PM, you wrote: A new type, say Cardinal as in Modula, would document for the user of a the only problem is what Haskell don't support automatic integral types conversion. you will need to write a lot of `fromIntegral` calls -- Best regards,

Re: [Haskell-cafe] Positive integers

2006-03-24 Thread Jared Updike
Fortunately there are already List functions like genericLength and genericTake, which can handle such a number type. Shouldn't be Peano numbers part of the standard libraries? Natural numbers are being discussed as a possible part of the new Haskell' standard.

[Haskell-cafe] Re: Positive integers

2006-03-24 Thread Aaron Denney
On 2006-03-24, Henning Thielemann [EMAIL PROTECTED] wrote: On Fri, 24 Mar 2006, Aaron Denney wrote: On 2006-03-24, Daniel McAllansmith [EMAIL PROTECTED] wrote: Unless I've missed it, there is no typeclass for positive integers in GHC. Is there any particular reason it doesn't exist? The

Re: [Haskell-cafe] Re: Positive integers

2006-03-24 Thread Nils Anders Danielsson
On Fri, 24 Mar 2006, Henning Thielemann [EMAIL PROTECTED] wrote: Further on think of QuickCheck: A Cardinal type with an Arbitrary instance would save us the (=0) condition and it would reduce the number of tests that must be skipped because of non-fulfilled conditions. Because I was

Re: [Haskell-cafe] planet.haskell.org? for Haskell blogs

2006-03-24 Thread Neil Mitchell
Hi Is it possible to have an RSS feed for Planet Haskell? i.e. so I can read all the Haskell related blogs with my feed reader without being subscribed to all of them individually. Thanks Neil On 3/23/06, Antti-Juhani Kaijanaho [EMAIL PROTECTED] wrote: Isaac Jones wrote: Cool, if you think

[Haskell-cafe] Re: Positive integers

2006-03-24 Thread Henning Thielemann
On Fri, 24 Mar 2006, Aaron Denney wrote: Basically, my big objection is that it's hard to define many useful operations on them that are statically safe. Why not defining the Torsor class you suggested? Any definition of Num a for instance leaves a whole bunch of unsafe methods, or just

Re: [Haskell-cafe] Re: Positive integers

2006-03-24 Thread Iavor Diatchki
Hello, On 3/23/06, Ben Rudiak-Gould [EMAIL PROTECTED] wrote: Daniel McAllansmith wrote: I can see the domain bounds check would be a problem in theory, but in practice doesn't the type enforce that? Keeping Word positive costs nothing because it just overflows. Wouldn't it be much the

[Haskell-cafe] Re: Positive integers

2006-03-24 Thread Aaron Denney
On 2006-03-24, Henning Thielemann [EMAIL PROTECTED] wrote: On Fri, 24 Mar 2006, Aaron Denney wrote: Basically, my big objection is that it's hard to define many useful operations on them that are statically safe. Why not defining the Torsor class you suggested? Torsor is not quite the

Re: [Haskell-cafe] Question about Arrows and Computation by Paterson

2006-03-24 Thread Reilly Hayes
On Thu, 2006-03-23 at 17:37 +, Ross Paterson wrote: Try this picture: (s,(b,d)) | | unassoc v ((s,b), d) | | f | x | id v v ((s',c), d) | | assoc v (s',(c,d)) The

Re: [Haskell-cafe] Re: Positive integers

2006-03-24 Thread Henning Thielemann
On Fri, 24 Mar 2006, Aaron Denney wrote: Without breaking compatibility? But class instances become invalid if the hierarchy is modified. No, compatibility will be broken. Hopefully not for most uses -- I don't think most people define new instances, and those that do will be able to do so

[Haskell-cafe] (!!) operator usage

2006-03-24 Thread Neil Rutland
Hi there, I hope i have sent this in the right format - i gather i may have been rude by sending it incorrectly - if this is still wrong give me a shout. Anyway today i am enquiring about how to use the !! operator - i have looked at Zvons Haskell refeernce and it says that it takes a list(

[Haskell-cafe] Re: (!!) operator usage

2006-03-24 Thread Tom Davies
Neil Rutland neilrutland2 at hotmail.com writes: [snip] type Bob = [(Int, Int)] newLine :: Bob newLine = [(1,4)] i have tried to use the follwing but it returns the error below it. newLine !! 0 - (so that should give it the newLine list and try and return the 1st element of the list)

Re: [Haskell-cafe] (!!) operator usage

2006-03-24 Thread Stefan Holdermans
Neil, Basically in this example i would like to return the value 4 type Bob = [(Int, Int)] newLine :: Bob newLine = [(1,4)] i have tried to use the follwing but it returns the error below it. newLine !! 0 - (so that should give it the newLine list and try and return the 1st element of the

Re: [Haskell-cafe] planet.haskell.org? for Haskell blogs

2006-03-24 Thread Antti-Juhani Kaijanaho
Neil Mitchell wrote: Hi Is it possible to have an RSS feed for Planet Haskell? i.e. so I can read all the Haskell related blogs with my feed reader without being subscribed to all of them individually. Now there is an RSS 2.0 and an Atom feed. ___