[Haskell-cafe] Fractional/negative fixity?

2006-11-03 Thread Dan Weston
Here's an idea that (I think) is useful and backwards compatible: fractional and negative fixity. There have been 3 separate times where I've wanted an operator just above 0 ($) but less than 1 (>>= or >>>), or else just below 0 (like a superlow $$) infix 0.5 ??? infix -1 $$ The only cha

[Haskell-cafe] Re: [Haskell] GHC inferred type different for pointed/point-free defs?

2006-11-03 Thread Neil Mitchell
Hi, You probably want to read up on: Monomorphism restriction (I don't think this applies here, but I'm never too sure!): http://www.haskell.org/hawiki/MonomorphismRestriction Defaulting: http://www.haskell.org/onlinereport/decls.html#sect4.3.4 I don't understand either to any great degree,

Re: [Haskell-cafe] Finding Memory Leaks

2006-11-03 Thread SevenThunders
Donald Bruce Stewart wrote: > > > > Hmm, are you missing a -O ? Does that help at all? > > -- Don > > > Adding the -O does not stop the memory leak problem. As for the profiler, it does make the CAF:main function show more erratic memory spikes, however no memory ramping is revealed eve

Re[4]: [Haskell-cafe]Prime Generator time limit exceeded

2006-11-03 Thread Bulat Ziganshin
Hello alaiyeshi, Friday, November 3, 2006, 4:23:40 PM, you wrote: > But I guess in this problem the first input line and the other are > different in their meaning. Thus if I use interact I should "parse" the > input(again), I guess. it seems that you don't understand that functional programmin

Re: [Haskell-cafe] Cost of seq (sorry about the old subject)

2006-11-03 Thread Malcolm Wallace
"Chad Scherrer" <[EMAIL PROTECTED]> wrote: > > afaik, seq cost is zero (except for evaluating expressions, of > > course) > > So if x has already been evaluated, does x `seq` y evaluate just as > quickly as y alone, or does it require extra cycles to make sure x has > been evaluated? My understa

[Haskell-cafe] Cost of seq (sorry about the old subject)

2006-11-03 Thread Chad Scherrer
On 11/2/06, Bulat Ziganshin <[EMAIL PROTECTED]> wrote: Hello Chad, Thursday, November 2, 2006, 8:49:17 PM, you [Chad] wrote: > Would it be possible for the type system to distinguish at compile > time whether something would need to be evaluated, and optimize away > redundant `seq`s? Maybe this

Re: Re[2]: [Haskell-cafe]Prime Generator time limit exceeded

2006-11-03 Thread alaiyeshi
Wow! Thank you for your suggestion. But I guess in this problem the first input line and the other are different in their meaning. Thus if I use interact I should "parse" the input(again), I guess.___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

[Haskell-cafe] Re: Non-integer part of a Double

2006-11-03 Thread Maurí­cio
Henning Thielemann wrote: On Thu, 2 Nov 2006, Sebastian Sylvan wrote: On 11/2/06, Maurí­cio <[EMAIL PROTECTED]> wrote: Hi, Is there a function to get that? I'm using \x -> x - fromIntegral(floor x) since I was not able to find something better, but I guess I have missed something in t

Re: Re[2]: [Haskell-cafe] Class

2006-11-03 Thread Slavomir Kaslev
On 11/3/06, Bulat Ziganshin <[EMAIL PROTECTED]> wrote: Hello Slavomir, Thursday, November 2, 2006, 9:59:38 PM, you wrote: >> one is okay, though, but you have to start ghc with >> -fallow-undecidable-instances and -fglasgow-exts I'm afraid. > Thanks, Sebastian. That was helpful. Are there any

Re[2]: [Haskell-cafe] How to improve speed? (MersenneTwister is several times slower than C version)

2006-11-03 Thread Bulat Ziganshin
Hello Donald, Thursday, November 2, 2006, 2:21:31 PM, you wrote: >> 10-20 times difference is typical for GHC programs. > It's really more like 2-4x. Sometimes better than C. > Where's this huge figure coming from Bulat? If you have code that > behaves like this, you should report it. are you

Re[2]: [Haskell-cafe]Prime Generator time limit exceeded

2006-11-03 Thread Bulat Ziganshin
Hello alaiyeshi, Thursday, November 2, 2006, 9:26:37 PM, you wrote: > I've met replicateM_ for the first time;-) This could be a > "template" for doing online-judge exercises I guess. And it's very useful for > newbies like me. make an date for 'interact' :))) -- Best regards, Bulat

Re: Fwd: [Haskell-cafe] Class

2006-11-03 Thread Bulat Ziganshin
Hello Slavomir, Thursday, November 2, 2006, 5:47:37 PM, you wrote: > class Show a => Visible a where > toString :: a -> String > toString = show > size :: a -> Int > size = length . show it's not that you need. it's definition of subclass, say class Set a => OrderedSet a -- B

Re[2]: [Haskell-cafe] Class

2006-11-03 Thread Bulat Ziganshin
Hello Slavomir, Thursday, November 2, 2006, 9:59:38 PM, you wrote: >> one is okay, though, but you have to start ghc with >> -fallow-undecidable-instances and -fglasgow-exts I'm afraid. > Thanks, Sebastian. That was helpful. Are there any papers on the subject? i recommend you to read in the fo

Re: [Haskell-cafe] Non-integer part of a Double

2006-11-03 Thread Henning Thielemann
On Thu, 2 Nov 2006, Sebastian Sylvan wrote: > On 11/2/06, Maurí­cio <[EMAIL PROTECTED]> wrote: > >Hi, > > > >Is there a function to get that? I'm using > > > > \x -> x - fromIntegral(floor x) > > > > since I was not able to find something better, but I guess I have missed > > something

Re[4]: [Haskell-cafe] Class

2006-11-03 Thread Bulat Ziganshin
Hello Slavomir, Thursday, November 2, 2006, 5:51:17 PM, you wrote: > I wouldn't like to manually define instances of Visible for all types > that have Show instances. believe it or not but i had the same problems > I think I need something like that: > class Visible a where > instance Show a =

Re: [Haskell-cafe] Re: Haskell-Cafe Digest, Vol 39, Issue 6

2006-11-03 Thread Bulat Ziganshin
Hello Chad, Thursday, November 2, 2006, 8:49:17 PM, you wrote: > Would it be possible for the type system to distinguish at compile > time whether something would need to be evaluated, and optimize away > redundant `seq`s? Maybe this is what the strictness analyzer does > already. afaik, seq cost

Re: [Haskell-cafe] Decorating a list of strings

2006-11-03 Thread Chris Kuklewicz
Steve Schafer wrote: > I have a list of text strings: > > ["Alice", "Bob", "Cindy", "Bob", "Bob", "Dave", "Cindy"] > > As you can see, some of the strings occur only once; others appear two > or more times. > > I would like to end up with a new list, according to the following > rules: > > 1)