Re: [Haskell-cafe] functional graphs

2008-01-21 Thread Christian Maeder
Thomas Hartman wrote: I don't think this will work. From http://www.haskell.org/ghc/docs/latest/html/libraries/fgl/src/Data-Graph-Inductive-Graph.html the minimal implementatin for Graph is -- | Minimum implementation: 'empty', 'isEmpty', 'match', 'mkGraph', 'labNodes' -- |

Re: [Haskell-cafe] functional graphs

2008-01-21 Thread Christian Maeder
Benja Fallenstein wrote: However, if you'd be able to live with data CGraph a b = CGraph [LNode a] (Node - Node - b) then you should be able to write the instance like this-- instance Graph CGraph where empty = CGraph [] (const $ error Node not in graph) isEmpty (CGraph xs _) =

Re[2]: [Haskell-cafe] Throwback of inferred types

2008-01-21 Thread Bulat Ziganshin
Hello Jon, Monday, January 21, 2008, 1:18:52 AM, you wrote: You're missing out on a lot if this isn't available for Haskell yet. I didn't realise just how invaluable this is until a system upgrade broke it and I really struggled to write OCaml code without it: I don't know how I managed

Re: [Haskell-cafe] functional graphs

2008-01-21 Thread Benja Fallenstein
Hi Christian, On Jan 21, 2008 10:57 AM, Christian Maeder [EMAIL PROTECTED] wrote: Thanks for pointing out this proposal. The actual problem is mkGraph that needs all the many edges created beforehand (that's what I wanted to avoid). Well, uh, at the risk of being obvious, if you can avoid

Re: [Haskell-cafe] Parsec benchmarks

2008-01-21 Thread hjgtuyl
I think you should try again, the link is not dead. On Sun, 20 Jan 2008 21:54:08 +0100, Jon Harrop [EMAIL PROTECTED] wrote: I'd like to compare the performance of Parsec to other parsers but the only reference to a benchmark I have found is a dead link from one of the papers about

RE: [Haskell-cafe] Re: Properties of optimizer rule application?

2008-01-21 Thread Henning Thielemann
On Thu, 17 Jan 2008, Simon Peyton-Jones wrote: | To give a precise example: If I have a sequence of 'map's | map f0 . map f1 . ... . map fn | then there is some length where this is no longer collapsed to a single | 'map'? (a) GHC tries to do as much as possible in a single iteration of

RE: [Haskell-cafe] Hamming's Problem

2008-01-21 Thread Jose Luis Reyes F .
Bertram Thanks for your help, I tried to solve the problem this weekend but I have some dudes. My reasoning is: The sequence is [1,a1,a2,a3,..] where a1 = h 1 1, a2 = h 1 a1, and so on So, I want to construct the list of lists [[1,a1,a2,a3], [h 1 1, h 1 a1, h 1 a2,..], [h a1 1, h a1 a1, h a1

Re: [Haskell-cafe] Re: need help for cabal-install

2008-01-21 Thread Steve Lihn
Duncan, I got the latest cabal. The stack overflow is fixed. But the install command still does not work (on a very simple package). Attached is the verbose output. It does not like to proceed somewhere between configure and build. But the verbose is not telling why! I also attached my cabal

Re: [Haskell-cafe] Hamming's Problem

2008-01-21 Thread Bertram Felgenhauer
Jose Luis Reyes F. wrote: Thanks for your help, I tried to solve the problem this weekend but I have some dudes. My reasoning is: The sequence is [1,a1,a2,a3,..] where a1 = h 1 1, a2 = h 1 a1, and so on So, I want to construct the list of lists [[1,a1,a2,a3], [h 1 1, h 1 a1, h 1

Re: [Haskell-cafe] threads + IORefs = Segmentation fault?

2008-01-21 Thread David Roundy
On Sat, Jan 19, 2008 at 08:36:55PM +0100, Alfonso Acosta wrote: On Jan 19, 2008 2:36 PM, David Roundy [EMAIL PROTECTED] wrote: Using ghc 6.6, but I've since isolated the bug as being unrelated to the IORefs and threading, it was in an FFI binding that somehow never died until I was testing

[Haskell-cafe] Newbie question

2008-01-21 Thread Alexander Seliverstov
Hi, I try to undestand why this code dosen't work f :: (Num a)=Integer-a f i = i Integer is an instance of Num, so why does this code produce error: Couldn't match expected type 'a' againsta inferred type 'Integer' ... ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] Newbie question

2008-01-21 Thread Brent Yorgey
2008/1/21 Alexander Seliverstov [EMAIL PROTECTED]: Hi, I try to undestand why this code dosen't work f :: (Num a)=Integer-a f i = i Integer is an instance of Num, so why does this code produce error: Couldn't match expected type 'a' againsta inferred type 'Integer' ... But the type of

[Haskell-cafe] ICFP2008 Call for Papers

2008-01-21 Thread Matthew Fluet (ICFP Publicity Chair)
Call for Papers ICFP 2008: International Conference on Functional Programming Victoria, BC, Canada, 22-24 September 2008 http://www.icfpconference.org/icfp2008 Submission deadline: 2 April 2008 ICFP 2008 seeks original

Re: [Haskell-cafe] Data.Binary questions

2008-01-21 Thread Lauri Pesonen
Hi Derek, Thanks for the reply. On 20/01/2008, Derek Elkins [EMAIL PROTECTED] wrote: You may want to consider using the other side of Data.Binary rather than the Binary class. The -class- Binary is intended for de/serialization when you don't care about the format. From the documentation:

[Haskell-cafe] Re: functional graphs

2008-01-21 Thread Mirko Rahn
Hello, It's a _complete_ graph, i.e. there is an edge between every two nodes. I want to compute the minimum spanning tree. Eventually I want to have a sub-optimal solution for the travelling salesman problem (TSP). A direct solution for this problem would be: -- | place a f-minimal

[Haskell-cafe] Re: Newbie question

2008-01-21 Thread Jon Fairbairn
Alexander Seliverstov [EMAIL PROTECTED] writes: How does caller choose which particular instance of Num they want? They specify the type... or just pass the result to something that specifies the type. Try it in ghci: Prelude let f:: Integral i = Integer - i; f = fromIntegral Prelude let g ::

Re: [Haskell-cafe] Newbie question

2008-01-21 Thread Alexander Seliverstov
How does caller choose which particular instance of Num they want? In object-oriented language If function return type is an interface it means that it can return any implementation of this interface, but caller can't choose which particular inplementation they want. What the difference between

RE: [Haskell-cafe] Re: Properties of optimizer rule application?

2008-01-21 Thread Simon Peyton-Jones
| I think I also found a typo: Quite right, thanks -- now fixed. | Recently I found that specialisation interacts in an unexpected way with | explicit RULES (and with inlining). I used a function multiple times and | this seemed to make GHC specialising this function (although I did not | used a

Re: [Haskell-cafe] Hangman game

2008-01-21 Thread Jake McArthur
On Jan 20, 2008, at 1:03 PM, Yitzchak Gale wrote: Generating an infinite list from a random generator burns up the generator, making it unusable for any further calculations. That's what the split function is for. ^_^ - Jake ___ Haskell-Cafe

Re: [Haskell-cafe] Re: Newbie question

2008-01-21 Thread Alexander Seliverstov
So, the function type (Num a)=Integer-a means that return value of this function can be cast to any particular instance of class Num. Ok. I have a my own class class A a and want to write function like this f:: (A a)=Integer-a. Can I do it? 2008/1/21, Jon Fairbairn [EMAIL PROTECTED]:

Re: [Haskell-cafe] Re: Newbie question

2008-01-21 Thread Brent Yorgey
2008/1/21 Alexander Seliverstov [EMAIL PROTECTED]: So, the function type (Num a)=Integer-a means that return value of this function can be cast to any particular instance of class Num. Ok. I have a my own class class A a and want to write function like this f:: (A a)=Integer-a. Can I do it?

[Haskell-cafe] Yi and Data.ByteString

2008-01-21 Thread Cetin Sert
1) Can anyone tell me how I can build Yi or point me to a binary release of that editor? I tried to follow the instructions on http://www.nobugs.org/developer/yi/building.html but got a missing component error each time. 2) When if ever is Data.ByteString going to be the default string

Re: [Haskell-cafe] Yi and Data.ByteString

2008-01-21 Thread Thomas Schilling
On Mon, 2008-01-21 at 19:12 +0100, Cetin Sert wrote: 1) Can anyone tell me how I can build Yi or point me to a binary release of that editor? I tried to follow the instructions on http://www.nobugs.org/developer/yi/building.html but got a missing component error each time. You need

[Haskell-cafe] Haskell web dev: Using Haskell and HAppS for Openomy API v2.0

2008-01-21 Thread Don Stewart
A deployment of HAppS, AlexJ et al's web framework for Haskell, at openomy, The latest release of our API is written in Haskell using the new HAppS framework. The good news, Since being in production, we've so far found very few issues and everything runs quickly and

Re: [Haskell-cafe] Yi and Data.ByteString

2008-01-21 Thread gwern0
On 2008.01.21 19:12:26 +0100, Cetin Sert [EMAIL PROTECTED] scribbled 1.9K characters: 1) Can anyone tell me how I can build Yi or point me to a binary release of that editor? I tried to follow the instructions on http://www.nobugs.org/developer/yi/building.html but got a missing

Re: [Haskell-cafe] Yi and Data.ByteString

2008-01-21 Thread pierre
Hello, On Mon, Jan 21, 2008 at 07:12:26PM +0100, Cetin Sert wrote: 2) When if ever is Data.ByteString going to be the default string representation in GHC? Why would you need such a thing? ByteStrings don't have any unicode support, and they can be quite slow for small strings. They are just a

[Haskell-cafe] Draft chapters of Real World Haskell now publicly available

2008-01-21 Thread Bryan O'Sullivan
John, Don and I are pleased to announce the beginning of the public beta programme for our upcoming book, Real World Haskell. For further details, please see the following blog entry: http://www.realworldhaskell.org/blog/2008/01/21/finally-the-public-beta-programme-begins/ Thanks to all of the

Re: [Haskell-cafe] Data.Binary questions

2008-01-21 Thread Derek Elkins
On Mon, 2008-01-21 at 16:18 +, Lauri Pesonen wrote: Hi Derek, Thanks for the reply. On 20/01/2008, Derek Elkins [EMAIL PROTECTED] wrote: You may want to consider using the other side of Data.Binary rather than the Binary class. The -class- Binary is intended for de/serialization

[Haskell-cafe] Re: Newbie question

2008-01-21 Thread Stefan Monnier
How does caller choose which particular instance of Num they want? By passing the type they want. That's what the Num a = thingy does. In object-oriented language If function return type is an interface it means that it can return any implementation of this interface, but caller can't

Re: [Haskell-cafe] Re: Newbie question

2008-01-21 Thread Peter Verswyvelen
Hey, I knew about the forall (I use that to represent OO style collections, very handy), but not about the exists. Thanks. But GHC 6.8.2 (with -fglasgow-exts) does not seem to accept this exists keyword? Does a book or document already exist (except the website) that tells more about not

Re: [Haskell-cafe] Draft chapters of Real World Haskell now publicly available

2008-01-21 Thread Peter Verswyvelen
Oops, I just replied to another message asking for such a book! Amazing that my prayers are answered even before I asked them ;-) Peter On Mon, 2008-01-21 at 11:53 -0800, B ryan O'Sullivan wrote: John, Don and I are pleased to announce the beginning of the public beta programme for our

Re: [Haskell-cafe] Re: Newbie question

2008-01-21 Thread Derek Elkins
On Mon, 2008-01-21 at 22:36 +0100, Peter Verswyvelen wrote: Hey, I knew about the forall (I use that to represent OO style collections, very handy), but not about the exists. Thanks. But GHC 6.8.2 (with -fglasgow-exts) does not seem to accept this exists keyword? That's because it isn't GHC

[Haskell-cafe] Re: Draft chapters of Real World Haskell now publicly available

2008-01-21 Thread Achim Schneider
Bryan O'Sullivan [EMAIL PROTECTED] wrote: We look forward to your feedback! My browser shows me this: Dat geev en Fehler, as http://book.realworldhaskell.org/beta/funcstypes.html laadt wöör: Tiet op Server aflopen Verbinnen bestunn na book.realworldhaskell.org an Port 80 I think you have

Re: [Haskell-cafe] Draft chapters of Real World Haskell now publicly available

2008-01-21 Thread Daniel Fischer
Am Montag, 21. Januar 2008 20:53 schrieb Bryan O'Sullivan: John, Don and I are pleased to announce the beginning of the public beta programme for our upcoming book, Real World Haskell. For further details, please see the following blog entry:

Re: [Haskell-cafe] Re: Newbie question

2008-01-21 Thread Wolfgang Jeltsch
Am Montag, 21. Januar 2008 21:55 schrieb Derek Elkins: On Mon, 2008-01-21 at 22:36 +0100, Peter Verswyvelen wrote: Hey, I knew about the forall (I use that to represent OO style collections, very handy), but not about the exists. Thanks. But GHC 6.8.2 (with -fglasgow-exts) does not seem to

Re: [Haskell-cafe] Re: need help for cabal-install

2008-01-21 Thread Duncan Coutts
On Mon, 2008-01-21 at 10:15 -0500, Steve Lihn wrote: Duncan, I got the latest cabal. The stack overflow is fixed. But the install command still does not work (on a very simple package). Attached is the verbose output. It does not like to proceed somewhere between configure and build. But the

Re: [Haskell-cafe] Hangman game

2008-01-21 Thread Yitzchak Gale
I wrote: Generating an infinite list from a random generator burns up the generator, making it unusable for any further calculations. Jake McArthur wrote: That's what the split function is for. ^_^ Yes, that is a nice approach. I have been avoiding it due to the following comment in the docs

Re: [Haskell-cafe] Hangman game

2008-01-21 Thread Yitzchak Gale
I wrote: That said, looking around briefly, I came up with this paper by L'Ecuyer et al that does seem to describe a decent random generator with properties of split worked out: Derek Elkins wrote: According to the documentation That -is- what we have. No, we have a much older algorithm of

Re: [Haskell-cafe] Hangman game

2008-01-21 Thread Derek Elkins
On Tue, 2008-01-22 at 02:24 +0200, Yitzchak Gale wrote: I wrote: That said, looking around briefly, I came up with this paper by L'Ecuyer et al that does seem to describe a decent random generator with properties of split worked out: Derek Elkins wrote: According to the documentation

Re: [Haskell-cafe] Yi and Data.ByteString

2008-01-21 Thread Cetin Sert
-- Yi that's the error message I got following the instructions on http://www.nobugs.org/developer/yi/building.html setup: At least the following dependencies are missing: fingertree -any make: *** [dist/setup-config] Error 1 Where can I get fingertree from? Do I need a specific version of

Re: [Haskell-cafe] Re: Hangman game

2008-01-21 Thread Yitzchak Gale
Achim Schneider wrote: Speaking of that, the generators that come in the box are awfully slow, I ended up calling into http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/index.html via the ffi. Yes, it would be nice to have the Mersenne Twister available. Not only for speed - it is widely

Re: [Haskell-cafe] Yi and Data.ByteString

2008-01-21 Thread Don Stewart
cetin.sert: -- Yi that's the error message I got following the instructions on [1]http://www.nobugs.org/developer/yi/building.html setup: At least the following dependencies are missing: fingertree -any make: *** [dist/setup-config] Error 1 Where can I get

RE: [Haskell-cafe] Control.Concurrent.STM.old?

2008-01-21 Thread Tim Harris (RESEARCH)
Hi, I don't think we included this in the version we checked in. It should be fairly easy to add to the current implementation: it will mirror ReadTVar except that the old value is always selected. I'm afraid I can't remember exactly why we didn't include it. One reason might have been that

Re: [Haskell-cafe] Hangman game

2008-01-21 Thread Ronald Guida
Thank you for the positive responses. The best kind of feedback is the kind that makes me have to think, and I've done alot of thinking. _Regarding monads and interfaces_ Paul Johnson wrote: 1: Your GameState type can itself be made into a monad. Take a look at the All About Monads tutorial,

Re: [Haskell-cafe] Haskell web dev: Using Haskell and HAppS for Openomy API v2.0

2008-01-21 Thread Ian Sefferman
Indeed, from us at Openomy, we thank all those involved in HAppS for their work, and more importantly, their help with all our questions along the way. :) We're happy to answer any questions anyone may have on our experience, implementation, etc. Ian On 1/21/08, Don Stewart [EMAIL PROTECTED]

[Haskell-cafe] non-alphabetical mathematical symbols as non-infix function names

2008-01-21 Thread Cetin Sert
(¬) :: Bool → Bool (¬) q = not q q = True ¬ q : parser error on input q ¬ : parser error (possibly incorrect indentation) (¬ q) : Couldn't match expected type `Bool - t' against inferred type `Bool' In the expression: (� True) In the definition of `it': it = (� True) * (q ¬) : False (Why) is it

Re[2]: [Haskell-cafe] Newbie question

2008-01-21 Thread Bulat Ziganshin
Hello Alexander, Monday, January 21, 2008, 7:36:18 PM, you wrote: How does caller choose which particular instance of Num they want? In object-oriented language If function return type is an interface it means that it can return any implementation of this interface, but caller can't choose

Re: [Haskell-cafe] Yi and Data.ByteString

2008-01-21 Thread Bulat Ziganshin
Hello Cetin, Monday, January 21, 2008, 9:12:26 PM, you wrote: 2) When if ever is Data.ByteString going to be the default string representation in GHC? there is no need, you can just use it as any other type. having rich library is enough condition -- Best regards, Bulat

Re: [Haskell-cafe] Re: Newbie question

2008-01-21 Thread Bulat Ziganshin
Hello Jon, Monday, January 21, 2008, 9:28:09 PM, you wrote: Ok. I have a my own class class A a and want to write function like this f:: (A a)=Integer-a. Can I do it? But in general you are going to want something a bit more useful, which means that you have to have a path from Integer to