Re: [Haskell-cafe] Ambiguous type signature in class declaration

2005-04-28 Thread Bo Herlin
Doh, i have another question: Lets say i do as you wrote: class CRank a b where rank :: a - b - Maybe Integer -- Nothing means b is out of range or badly constructed unrank :: a - Integer - Maybe b -- Nothing means rank is out of range class CCountable a where count :: a - Maybe

RE: [Haskell-cafe] fptools in darcs now available

2005-04-28 Thread Simon Marlow
On 28 April 2005 04:52, John Goerzen wrote: I am pleased to announce that I have used tailor.py to successfully convert the entire history of fptools HEAD branch, dating back to 1996, from CVS to darcs. For those of you that don't know, fptools represents the development area for the GHC

Re: [Haskell-cafe] fptools in darcs now available

2005-04-28 Thread Gour
Simon Marlow ([EMAIL PROTECTED]) wrote: Great news, thanks John. Is it possible to set up a two-way synch so we can move over to darcs gradually? It's not really practical for us to move over in one go, we've simply accumulated too many dependencies on CVS, and there are lots of people

Re: [Haskell-cafe] Ambiguous type signature in class declaration

2005-04-28 Thread Bo Herlin
Hi again Next approach: module Cafe where class CRankable a where rank :: a b - b - Maybe Integer -- Nothing means b is out of range or badly constructed unrank :: a b - Integer - Maybe b -- Nothing means rank is out of range count :: a b - Maybe Integer -- Nothing means infinity

[Haskell-cafe] REMINDER: Contributions to the HCA Report (May 2005 edition)

2005-04-28 Thread Andres Loeh
Dear Haskellers, the deadline for the May 2005 edition of the Haskell Communities and Activities Report is only a few days away -- but this is still enough time to make sure that the report contains a section on *your* project, on the interesting stuff that you've been doing; using or affecting

Re: [Haskell-cafe] Ambiguous type signature in class declaration

2005-04-28 Thread Benjamin Franksen
On Thursday 28 April 2005 08:42, Bo Herlin wrote: Doh, i have another question: Lets say i do as you wrote: class CRank a b where rank :: a - b - Maybe Integer -- Nothing means b is out of range or badly constructed unrank :: a - Integer - Maybe b -- Nothing means rank is out

Re: [Haskell-cafe] fptools in darcs now available

2005-04-28 Thread John Goerzen
On Thu, Apr 28, 2005 at 10:01:05AM +0100, Simon Marlow wrote: On 28 April 2005 04:52, John Goerzen wrote: Is it possible to set up a two-way synch so we can move over to darcs gradually? It's not really practical for us to move over in one go, we've simply accumulated too many dependencies

RE: [Haskell-cafe] fptools in darcs now available

2005-04-28 Thread Simon Marlow
On 28 April 2005 14:26, John Goerzen wrote: To do that though, we should really identify a permanent home for the canonical fptools darcs repo. I'm not really set up to provide accounts for those that would need write access, and I don't want to be the gatekeeper (I suspect nobody else wants

[Haskell-cafe] RFE: Extensible algebraic user-defined data types?

2005-04-28 Thread Dimitry Golubovsky
Hi, Is it possible to have such a feature in the future versions of the Haskell language? For example, there is an Either datatype which is Left a| Right b. Suppose I want to extend this datatype to the one including possibility of neither Left or Right (i. e. None). Currently I have to use

[Haskell-cafe] How to speed things up

2005-04-28 Thread Dmitry Vyal
Hello everybody. I have a long list consisted of a small number (about a dozen) of elements repeating in random pattern. I know all the possible elements. I need to count number of occurences of each particular element and to do i quickly. For example quick_func Eq a = [a] - [(a,Int)]

Re: [Haskell-cafe] Ambiguous type signature in class declaration

2005-04-28 Thread Bo Herlin
Benjamin Franksen wrote: (lots of information...) HTH, Ben Thank you, very generous indeed. This WILL certanly help, once i have learned more of the basics ;-) I have to try out this functional-dependencies-thing before i understand everything you have typed. Thanks! /Bo

[Haskell-cafe] Newbie question -- fromInt

2005-04-28 Thread Tim Rowe
I'm working through The craft of functional programming , and I've come to excercise 3.14: Give a function to return the average of three integers. My attempt at an answer is: averageThree :: Int - Int - Int - Float averageThree a b c = fromInt(a + b + c) / 3 but when I try to load this file I

Re: [Haskell-cafe] How to speed things up

2005-04-28 Thread Greg Buchholz
Dmitry Vyal wrote: Hello everybody. I have a long list consisted of a small number (about a dozen) of elements repeating in random pattern. I know all the possible elements. I need to count number of occurences of each particular element and to do i quickly. For example quick_func

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

2005-04-28 Thread Cale Gibbard
The function fromInt is no longer around. Use fromIntegral instead, which works with Int and Integer. On 4/28/05, Tim Rowe [EMAIL PROTECTED] wrote: I'm working through The craft of functional programming , and I've come to excercise 3.14: Give a function to return the average of three

[Haskell-cafe] about Ghci

2005-04-28 Thread SCOTT J.
Hi, I use Windows XP and I like to start Ghci in extended mode. What do I have to do in order not having to type always :set -fglasgow-exts thanks Jan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] How to speed things up

2005-04-28 Thread Cale Gibbard
I'd use a Map in GHC 6.4: count xs = toList $ fromListWith (+) (zip xs (repeat 1)) or a FiniteMap in earlier versions: count xs = fmToList $ addListToFM_C (+) emptyFM (zip xs (repeat 1)) both of these seem to be quite fast. - Cale On 4/28/05, Dmitry Vyal [EMAIL PROTECTED] wrote: Hello

[Haskell-cafe] Re: about Ghci

2005-04-28 Thread Peter Simons
SCOTT J writes: What do I have to do in order not having to type always :set -fglasgow-exts Add the line {-# OPTIONS -fglasgow-exts #-} at the top of the source code. Then the flag will be set when you load the module. This works for all kind of settings:

Re: [Haskell-cafe] about Ghci

2005-04-28 Thread Christian Maeder
SCOTT J. wrote: Hi, I use Windows XP and I like to start Ghci in extended mode. What do I have to do in order not having to type always :set -fglasgow-exts under unix this line can be put in a file .ghci in your home directory. Maybe $HOME is a variable under windows as well (and it is

Re: [Haskell-cafe] How to speed things up

2005-04-28 Thread Dmitry Vyal
Cale Gibbard wrote: I'd use a Map in GHC 6.4: count xs = toList $ fromListWith (+) (zip xs (repeat 1)) or a FiniteMap in earlier versions: count xs = fmToList $ addListToFM_C (+) emptyFM (zip xs (repeat 1)) both of these seem to be quite fast. - Cale Thanks, this is significaly faster than

Re: [Haskell-cafe] How to speed things up

2005-04-28 Thread Greg Buchholz
Dmitry Vyal wrote: By the way, how to use Unboxed arrays and unsafeAccumArray Greg Buchholz mentioned? I can't find them in GHC 6.2 documentation. http://www.haskell.org/~simonmar/haddock-example/Data.Array.Base.html Greg Buchholz ___

RE: [Haskell-cafe] How to speed things up

2005-04-28 Thread Simon Marlow
On 28 April 2005 19:21, Greg Buchholz wrote: Dmitry Vyal wrote: By the way, how to use Unboxed arrays and unsafeAccumArray Greg Buchholz mentioned? I can't find them in GHC 6.2 documentation. http://www.haskell.org/~simonmar/haddock-example/Data.Array.Base.html Please use the

[Haskell-cafe] Writing functions in Haskell.

2005-04-28 Thread Daniel Carrera
Hello, I'm trying to get started with Haskell. I must say that as good as the language must be, the documentation was been a source of frustration. Only one document actually showed me how to get started (ie. run hugs or ghci), and I was asked to give out my email address before getting it.

Re: [Haskell-cafe] Writing functions in Haskell.

2005-04-28 Thread Cale Gibbard
Hi, I'm sorry to hear that you've been having a hard time finding good references. From the example you gave, it looks like you're using Yet Another Haskell Tutorial from http://www.isi.edu/~hdaume/htut/ which is actually my favourite tutorial. When using hugs or ghci, you should note that what

Re: [Haskell-cafe] Writing functions in Haskell.

2005-04-28 Thread Daniel Carrera
Hello Cale, Thank you for your help. Cale Gibbard wrote: From the example you gave, it looks like you're using Yet Another Haskell Tutorial from http://www.isi.edu/~hdaume/htut/ which is actually my favourite tutorial. The tutorial itself is quite good, and I like it. I guess I've had a long day,

Re: [Haskell-cafe] Writing functions in Haskell.

2005-04-28 Thread Daniel Carrera
Alright, I have what I believe must be a simple question. As one of the exercises for the Haskell tutorial I got I have to implement an alternative to the 'map' function. This is what I have: - my/prompt $ cat Test.hs module Test where my_map p [] = [] my_map p

Re: [Haskell-cafe] Writing functions in Haskell.

2005-04-28 Thread Hal Daume III
Try: module Test where import Char ... then you don't have to load it in Hugs. When you load it, I think (could be wrong, I'm not a big hugs guy) it's clearing the fact that you loaded Test. On Thu, 28 Apr 2005, Daniel Carrera wrote: Alright, I have what I believe must be a simple

Re: [Haskell-cafe] RFE: Extensible algebraic user-defined data types?

2005-04-28 Thread David Menendez
Benjamin Franksen writes: On Thursday 28 April 2005 16:48, Dimitry Golubovsky wrote: PS Or is there a similar feature in the language already? Not one I know of. The type-indexed co-products from Appendix C of the HList paper[1] are along those lines, but probably not convenient enough for