Re[2]: [Haskell-cafe] Great language shootout: reloaded
Hello Sebastian, Saturday, November 11, 2006, 3:51:09 AM, you wrote: Meassuring lines of code is certainly not perfect, but IMO it's a lot more useful as a metric then gzipped bytes. why they don't use word count?? -- Best regards, Bulatmailto:[EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Great language shootout: reloaded
Hello Isaac, Saturday, November 11, 2006, 5:56:57 AM, you wrote: 2) Some Haskell programs were pushed into 'interesting alternative implementations' because they'd strayed so far from the spirit of the benchmark. (It takes a while for people to notice and complain, but eventually they do.) it's very real :) while ghc allows to write rather fast programs, such programs are much harder to write and manage than even equivalent C ones! just for comparison: -- compact, but very slow s = sum arr // not so compact, but very fast double sum=0; for(int i=0; i10; i++) sum+=arr[i]; // nor fast, nor compact, nor in Haskell spirit anyway :)) sum' - newIORef 0 for 0 10 $ \i - do x - unsafeRead arr i sum - readIORef sum' writeIORef sum' (sum+x) for :: Int - Int - (Int - IO a) - IO () -- Faster equivalent of mapM_ action [from..to-1] for from to action = go from where go i | i=to = return () | otherwise = do action i go $! (i+1) -- Best regards, Bulatmailto:[EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: aggressiveness of functional dependencies
Nicolas Frisby wrote: First off, thanks for the reply. I am accustomed to GHC ignoring instance contexts as you mentioned. It's the mostly part that I'm curious about: mostly implies there's some phases that don't ignore context. Is that only the checking the type of the method definitions and absolutely nothing else? So it seems... I just said mostly because I don't know exactly... Though I strongly suspect, like you, that the preconditions are only used in type inference/checking and not for overlapping instances and similar questions related to uniqueness of instance declarations. My project is rather committed to GHC, but could you elaborate on your reference to Hugs being different? By tradition from Gofer, Hugs implements type classes more flexible than GHC does. I once experimented with the following code using overlapping instances: data Lift a = Lift a type Test = Char class Message m o where send :: m - o - Test instance Message (o - Test) o where send m o = m o instance Message m o = Message m (Lift o) where send m (Lift o) = send m o msg :: Test - Test msg = id r1 = send msg 'a' r2 = send msg (Lift 'b') It implements some kind of subtyping. GHC won't typecheck this but hugs -98 +m will. If I remember correctly, the problem was with instance Message (Lift a - Test) (Lift a) Does this follow from the first or from the second instance declaration? GHC ignores the precondition in the second declaration, thus believes it follows from both and consequently rejects it. But Hugs has no problems with that: it follows the precondition and sees that the second declaration does not apply to the culprit because there is no (instance (Lift a - Test) a). Note that if you add this instance later on (perhaps in a different module), things will break. The flexibility comes at a price: Gofer's type class system was unsound and I don't know how much Hugs comes close to this. Regards, apfelmus ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [wxhaskell-users] [Haskell-cafe] Announcement: new maintainers forr wxHaskell
On Tue, Nov 07, 2006 at 23:26:40 +0100, Henk-Jan van Tuyl wrote: I suggest [EMAIL PROTECTED], the GUI task force mailing list; nothing is going on there at the moment, but it seems the most appropriate list. Hmm... I guess I'm happy just using the wxhaskell-users list for now, but if we do switch to something, this is a likely candidate. Although in the future, if it does get more active, and more than one project decide to use the list, it might get confusing. Maybe that list would better be for cross toolkit discussions. -- Eric Kow http://www.loria.fr/~kow PGP Key ID: 08AC04F9 Merci de corriger mon français. pgpfmNMXoRsaZ.pgp Description: PGP signature - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___ wxhaskell-users mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/wxhaskell-users
[Haskell-cafe] Why instances can't be hidden (was: non-total operator precedence order)
Benjamin Franksen wrote: Henning Thielemann wrote: On Fri, 10 Nov 2006, Benjamin Franksen wrote: Although one could view this as a bug in the offending module it makes me somewhat uneasy that one additional import can have such a drastic effect on the code in a module /even if you don't use anything from that module/. It's the same as with instance declarations, isn't it? I don't want to defend the problems arising with todays anonymous instance declarations, Right. However, with instances I can imagine solutions that avoid naming them, that is, I could imagine to write something like select instance C T1 T2 ... Tn from module M or import M hiding (instance C T1 T2 ... Tn, ) Such a feature could prove extremely useful in practice. Disclaimer: I am almost sure that there is something I have overlooked that makes such a simple solution impossible, otherwise it would have been proposed and implemented long ago... I think the reason you can't do this kind of thing is that within any set of modules that is compiled at the same time, anywhere in any of these modules, if you have a type T that's an instance of class C, then all occurrences of C T must refer to the exact same instance declaration or else things would get totally messed up when/if the compiler did whole program optimization. In other words, the instances are actually properties of the type(s) themselves so allowing different modules to see different implementations of the instances would break the conceptual merging of modules (modulo renaming) that occurs at compile time. Regards, Brian. -- Logic empowers us and Love gives us purpose. Yet still phantoms restless for eras long past, congealed in the present in unthought forms, strive mightily unseen to destroy us. http://www.metamilk.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] (twice head) (twice tail)
Over on comp.lang.functional ( http://xrl.us/s6kv ), Toby Kelsey is wondering about writing a function twice that applies a function to an argument two times... twice' :: (a - a) - a - a twice' f x = f (f x) ...that works for things like twice succ 0 and twice tail [1,2,3], but the type signature means you can't try something like twice head [[1]]. You can get the twice head case to work with a function like... twice'' :: (forall a. (m a) - a) - (m (m b)) - b twice'' f x = f (f x) ...and if you want something like twice (flip (:) []), you'd use... twice''' :: (forall a. a - (m a)) - b - (m (m b)) twice''' f x = f (f x) ...it seems like those type signatures have at least a passing resemblance, so I was wondering if you could use type classes to combine these functions. I tried something like... class Twice a b c | a b - c where twice :: a - b - c instance Twice (a-a) a a where twice f x = f (f x) instance Twice (forall a. (m a) - a) (m (m b)) b where twice f x = f (f x) ...but with ghc-6.6 it chokes with... Illegal polymorphic or qualified type: forall a. m a - a In the instance declaration for `Twice (forall a. (m a) - a) (m (m b)) b' ...I can't say I'm surprised, but I was wondering if anyone else has thoughts on how this limitation might be worked around. Curious, Greg Buchholz ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Great language shootout: reloaded
Donald Bruce Stewart wrote: -snip- I agree. Breaking the rules was mainly the reason for the drop. Entries like chameneos and fasta. Also, the other language teams kept improving things. Yes, I missed that opportunity for listing things in threes ;-) Over the year improved programs were contributed for other languages. In contrast to the last focussed effort by the Haskell community, many of the other programs are contributed by individuals working alone, over many weeks. Other language (perl, iirc) were affected far worse by the gzipping. gzip is an interesting measurement, and it doesn't hurt Haskell too much either way -- short Haskell programs stay short when compressed. As a result, rewriting verbose entries to ByteString will probably be much more useful :) Btw, Isaac, are we going to have any new parallelism benchmarks? I'd love to try out the SMP runtime ;) If we were to have a 'which is the silliest comparison on the computer language shootout' competition, I think chameneos and cheap-concurrency would be joint first - there are so many really really different approaches. Ideas for unicode text processing would be more welcome. Cheap talk? Check out Yahoo! Messenger's low PC-to-Phone call rates. http://voice.yahoo.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Section Syntax Errors
Hi all, I am learning about sections and currying from SOE. There are three functions below. The first is from SOE and the other two are my own practice functions. Why does the third function fail? --Test for negative numbers (from SOE pg 109). This works posInts :: [Integer] - [Bool] posInts = map ( 0) --Add 1 to a list of numbers. This works. addOne :: [Integer] - [Integer] addOne = map (+ 1) --Subtract 1 from a list of numbers. This does NOT work. --Fails in Hugs with: -- Instance of Num (Integer - Integer) required for definition of testSections -- I tried : subOne :: Num a = [a] - [a] --and : subOne :: [Float] - [Float] --in case the problem is with negative numbers. They both fail. --Without any type signature I get: -- Unresolved top level overloading subOne :: [Integer] - [Integer] subOne = map (- 1) Thanks... Deech _ Add a Yahoo! contact to Windows Live Messenger for a chance to win a free trip! http://www.imagine-windowslive.com/minisites/yahoo/default.aspx?locale=en-ushmtagline ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Section Syntax Errors
Hi Deech, Trying some things in Hugs: Hugs :t (+1) flip (+) 1 :: Num a = a - a Hugs :t (0) flip () 0 :: (Num a, Ord a) = a - Bool Hugs :t (-1) -1 :: Num a = a If you see, Haskell interprets the first two as sections, but the last one is treated as a unary minus, inside brackets - i.e. as though you typed the numeric literal -1. Haskell's treatment of negative literals is sometimes confusing... Thanks Neil On 11/11/06, Aditya Siram [EMAIL PROTECTED] wrote: Hi all, I am learning about sections and currying from SOE. There are three functions below. The first is from SOE and the other two are my own practice functions. Why does the third function fail? --Test for negative numbers (from SOE pg 109). This works posInts :: [Integer] - [Bool] posInts = map ( 0) --Add 1 to a list of numbers. This works. addOne :: [Integer] - [Integer] addOne = map (+ 1) --Subtract 1 from a list of numbers. This does NOT work. --Fails in Hugs with: -- Instance of Num (Integer - Integer) required for definition of testSections -- I tried : subOne :: Num a = [a] - [a] --and : subOne :: [Float] - [Float] --in case the problem is with negative numbers. They both fail. --Without any type signature I get: -- Unresolved top level overloading subOne :: [Integer] - [Integer] subOne = map (- 1) Thanks... Deech _ Add a Yahoo! contact to Windows Live Messenger for a chance to win a free trip! http://www.imagine-windowslive.com/minisites/yahoo/default.aspx?locale=en-ushmtagline ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Section Syntax Errors
On 11/11/06, Aditya Siram [EMAIL PROTECTED] wrote: subOne :: [Integer] - [Integer] subOne = map (- 1) The short answer is that this is interpreted as negative unity, rather than a section of binary minus. There are two common workarounds: subOne = map (subtract 1) subOne = map (+ (-1)) There's a whole minefield of opinions on whether this is the right syntax or not. I'm sure you could google through the archives to research this a bit more. -- -David House, [EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Livecoding music in Haskell
On Sat, 11 Nov 2006, Rohan Drape wrote: When I run this, then SuperCollider emits the error FAILURE ew Command not found Do you use some new feature? No, however you may need to run darcs update, there was an error in the OSC bundle encoder that I located writing that example: Wed Nov 8 21:29:28 EST 2006 Rohan Drape [EMAIL PROTECTED] * Fix error in OSC bundle encoder hence the sly reference to current repository in the post! Indeed, that was the problem. Thanks! Now the scheduling is really accurate. I'll use that in future. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe