Re: [Haskell-cafe] Implementing Mathematica

2007-05-31 Thread Stefan Holdermans
Jon, However, I can't think how you might return physically identical results when possible in Haskell. Essentially, you need a higher-order map function: val id_map : ('a - 'a) - 'a t - 'a t that returns its input when f x = x for every x. How might this be done? fmap :: (Functor

Re: [Haskell-cafe] Crazy idea: overloading function application notation

2007-05-31 Thread Stefan Holdermans
Jon, This is a crazy idea I've been working on: overload the syntax x y so it can mean function application f x = f(x) or multiplication x y = x*y. The reason is simply that I appreciate the brevity of MLs function application but I also appreciate the brevity of Mathematica's

Re: [Haskell-cafe] Crazy idea: overloading function application notation

2007-05-31 Thread Stefan Holdermans
Jon, This is a crazy idea I've been working on: overload the syntax x y so it can mean function application f x = f(x) or multiplication x y = x*y. On a related (?) note, but definitely not what you're after: there are constructor classes that allow you to lift function application into

Re: [Haskell-cafe] Language extensions

2007-05-31 Thread Tomasz Zielonka
On Wed, May 30, 2007 at 05:12:48PM +0200, Henk-Jan van Tuyl wrote: On Wed, 30 May 2007 09:38:10 +0200, Tomasz Zielonka [EMAIL PROTECTED] wrote: On Tue, May 29, 2007 at 09:43:03PM +0100, Andrew Coppin wrote: Henning Thielemann wrote: On Sun, 27 May 2007, Andrew Coppin wrote: But every now

Re: [Haskell-cafe] equations and patterns

2007-05-31 Thread Dan Mead
If you want to enforce associativity just create your own Eq instance and make it a pattern there. Initially when I started doing Haskell it seemed that you could just type an equation of constructors and have it enforced as a rule. This actually isn't the case (someone correct me if I'm wrong)

Re: [Haskell-cafe] equations and patterns

2007-05-31 Thread Stefan Holdermans
Dan, If you want to enforce associativity just create your own Eq instance and make it a pattern there. Could you elaborate on that? It's still early here and I've had only one cup of of coffee yet. Cheers, Stefan ___ Haskell-Cafe mailing

RE: [Haskell-cafe] Implementing Mathematica

2007-05-31 Thread Simon Peyton-Jones
| Incidentally, when I try to recompile with optimizations turned on, GHC | refuses to work: | | $ ghc htrace.hs -o htrace | $ ghc -O2 htrace.hs -o htrace | compilation IS NOT required Yes, I think it's a bug. GHC should really compare the flags used last time with the flags used this time, and

Re: [Haskell-cafe] equations and patterns

2007-05-31 Thread Thomas Schilling
On 5/31/07, Stefan Holdermans [EMAIL PROTECTED] wrote: Dan, If you want to enforce associativity just create your own Eq instance and make it a pattern there. Could you elaborate on that? It's still early here and I've had only one cup of of coffee yet. Cheers, Stefan QuickCheck

Re: [Haskell-cafe] updating packages

2007-05-31 Thread Thomas Schilling
Have you tried cabal-install? It may or may not work. (It should have come with Cabal.) On 5/31/07, jeff p [EMAIL PROTECTED] wrote: Hello, I just moved to ghc-6.6.1and was wondering if there is an automatic way to update the various packages I had installed previously. thanks, jeff

Re: [Haskell-cafe] Implementing Mathematica

2007-05-31 Thread Rodrigo Queiro
http://hackage.haskell.org/trac/ghc/ticket/106 It got changed to Won't Fix. Consider this a yell! On 31/05/07, Simon Peyton-Jones [EMAIL PROTECTED] wrote: | Incidentally, when I try to recompile with optimizations turned on, GHC | refuses to work: | | $ ghc htrace.hs -o htrace | $ ghc -O2

Re: [Haskell-cafe] enumFrom* strangeness on GHC?

2007-05-31 Thread Thomas Schilling
On 5/31/07, Felipe Almeida Lessa [EMAIL PROTECTED] wrote: BTW, how do you usually proceed when finding out why your code said Segmentation fault.? (should this question move to a new thread?) $ gdb my_crashing_program [wait till crush] [on the gdb command line:] $ bt [prints backtrace] If

RE: [Haskell-cafe] Implementing Mathematica

2007-05-31 Thread Ketil Malde
On Thu, 2007-05-31 at 08:46 +0100, Simon Peyton-Jones wrote: | $ ghc htrace.hs -o htrace | $ ghc -O2 htrace.hs -o htrace | compilation IS NOT required Yes, I think it's a bug. GHC should really compare the flags used last time with the flags used this time [...] As an (easier)

Re: [Haskell-cafe] What puts False before True?

2007-05-31 Thread PR Stanley
What is the basic philosophy for Bool being a member of Ord? you can do sth like Data.Set.fromList [minBound .. maxBound] :: Data.Set.Set Bool Sorry, not quite sure what you mean. What justifies False True? in most interpretations this equals: False == 0 True == 1 Indeed, it's the same in

Re: [Haskell-cafe] Implementing Mathematica

2007-05-31 Thread oleg
Jon Harrop wrote: However, I can't think how you might return physically identical results when possible in Haskell. Perhaps you might be interested then in the following function that non-destructively updates a subterm in a large term, preserving sharing. The function can be used to do a

Re: [Haskell-cafe] What puts False before True?

2007-05-31 Thread jerzy . karczmarczuk
This question: What is the basic philosophy for Bool being a member of Ord? ... What justifies False True? resulted in some answers: in most interpretations this equals: False == 0 True == 1 ... Although this is not a must, I would like to remind you also that in formal math

[Haskell-cafe] Re: equations and patterns

2007-05-31 Thread oleg
mingli yuan wrote: Seems mathematic axioms and pattern matching are different things. So how could I rewrite the equations to pattern matching? Which technique should I learn? Haskell is more suitable for re-writing systems, which are based on oriented equations. The question of orientation

[Haskell-cafe] Re: equations and patterns

2007-05-31 Thread mingli yuan
Thanks all. I just found this list is very nice. Everybody are so friendly. Regards, Mingli On 5/31/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: mingli yuan wrote: Seems mathematic axioms and pattern matching are different things. So how could I rewrite the equations to pattern matching?

Re: [Haskell-cafe] Implementing Mathematica

2007-05-31 Thread jerzy . karczmarczuk
This will be a long sermon. Sorry. Lennart Augustsson writes: Why do you seem so in awe of Mathematica? It's just another language with a good set of libraries. Claims that it is the best, fastest, etc comes from Wolfram advertising, no doubt. :) All this discussion began to degenerate a

Re: [Haskell-cafe] Implementing Mathematica

2007-05-31 Thread Jon Harrop
On Thursday 31 May 2007 00:10:27 Stefan O'Rear wrote: You said that constructing a specification is the hardest part of implementing Mathematica, and you also say you managed to clone it. Can you reveal your specification, or did WR give you a NDA? NDA, although I did most of the reverse

[Haskell-cafe] Re: Resolved: ffi linking problem

2007-05-31 Thread Simon Marlow
jeff p wrote: In case anyone else finds this useful... My linking problem was finally resolved by using the -fvia-C flag when compiling with ghc. Thanks to Stefan O'Rear who pointed out the possibility and wrote: Does using -fvia-C help at all? The C compiler understands header files and

[Haskell-cafe] Re: New book: Real-World Haskell!

2007-05-31 Thread Simon Marlow
Clifford Beshers wrote: Scott Cruzen wrote: I'd like to suggest the Mantis shrimp because they have excellent vision, they're long lived and they pack a punch. They certainly do. An excellent choice. Personally, I'd like to see the Giant Sea Bass., just because they're so stately:

Re: [Haskell-cafe] Crazy idea: overloading function application notation

2007-05-31 Thread Claus Reinke
This is a crazy idea I've been working on: overload the syntax x y so it can mean function application f x = f(x) or multiplication x y = x*y. The reason is simply that I appreciate the brevity of MLs function application but I also appreciate the brevity of Mathematica's multiplication. Is

[Haskell-cafe] Re: Building error Gtk2Hs under GHC 6.6.1 on Solaris 10 x86

2007-05-31 Thread Christian Maeder
How about switching from sed to perl, then? Cheers Christian Duncan Coutts schrieb: This is a bug in mk/chsDepend(.in) probably due to some difference in how sed works in Solaris compared to Linux. the mk/chsDepend shell script looks at a .chs file and tries to find all the lines that look

Re: [Haskell-cafe] Re: New book: Real-World Haskell!

2007-05-31 Thread Malte Milatz
Simon Marlow: While we're on fish, what's wrong with the humble Haddock? :-) It may at least make for a tasty curry ... ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Crazy idea: overloading function application notation

2007-05-31 Thread David House
On 31/05/07, Jon Harrop [EMAIL PROTECTED] wrote: Is it possible to implement this in Haskell using type classes? Is there any way this could actually be practicable? I had a go but didn't manage to quite get it. Here's my attempt, and the error it produces: {-# OPTIONS_GHC -fglasgow-exts #-}

Re: [Haskell-cafe] Re: Building error Gtk2Hs under GHC 6.6.1 on Solaris 10 x86

2007-05-31 Thread Duncan Coutts
On Thu, 2007-05-31 at 13:48 +0200, Christian Maeder wrote: How about switching from sed to perl, then? /me runs away screaming Actually the easier fix was to not look for an optional qualified string (ie dropping the \(qualified \)* clause) as it turns out we didn't need it anyway. Duncan

[Haskell-cafe] Re: Implementing Mathematica

2007-05-31 Thread Al Falloon
Jon Harrop wrote: On Wednesday 30 May 2007 22:15:55 Andrew Coppin wrote: Note that (as I understand it) GHC implements Haskell's Integer type using the GMP. And for some reason or other, they want to remove this feature... Arbitrary precision integers are quite a performance burden and they

Re: [Haskell-cafe] Language extensions

2007-05-31 Thread Roberto Zunino
Tomasz Zielonka wrote: On Wed, May 30, 2007 at 11:21:45PM +0200, Roberto Zunino wrote: ($!) Data.List.repeat -- ;-) unbounded types You got me - I'm not sure how to respond to that. Let's try: this function doesn't preserve computable equality. Ah, silly me! I checked that inequality

Re: [Haskell-cafe] Language extensions [was: Memoization]

2007-05-31 Thread Martin Percossi
I really liked this explanation -- very clear, with good analogies. Thanks! Martin My music: http://www.youtube.com/profile?user=thetonegrove Claus Reinke wrote: quantified types (forall/exist): an easy way to memorize this is to think of 'forall' as a big 'and' and of 'exists' as a big

Re: [Haskell-cafe] Language extensions

2007-05-31 Thread Jules Bean
Roberto Zunino wrote: Ah, silly me! I checked that inequality was preserved, but forgot that (==) diverges on infinite list! Indeed, strictly speaking, Eq [] does not satisfy the Eq invariant x==x. All haskell types contain divergence. So all Eq types have exactly this same problem. We

[Haskell-cafe] Has anyone looked into adding subtyping to Haskell?

2007-05-31 Thread Al Falloon
OCaml has been getting a lot of mileage from its polymorphic variants (which allow structural subtyping on sum types) especially on problems relating to AST transformations and the infamous expression problem. Has there been any work on extending Haskell's type system with structural

Re: [Haskell-cafe] Re: Implementing Mathematica

2007-05-31 Thread Jacques Carette
Jon Harrop wrote: Arbitrary precision integers are quite a performance burden and they are rarely used. I would not expect a language that is trying to be efficient to impose arbitrary precision integers (or floats). Apparently you have looked inside a computer *algebra* system, one that

Re: [Haskell-cafe] Crazy idea: overloading function application notation

2007-05-31 Thread Henning Thielemann
On Thu, 31 May 2007, Jon Harrop wrote: This is a crazy idea I've been working on: overload the syntax x y so it can mean function application f x = f(x) or multiplication x y = x*y. The reason is simply that I appreciate the brevity of MLs function application but I also appreciate the

Re: [Haskell-cafe] Has anyone looked into adding subtyping to Haskell?

2007-05-31 Thread Stefan Holdermans
Al, Has there been any work on extending Haskell's type system with structural subtyping? Koji Kagawaga. Polymorphic variants in Haskell. In Andres Loeh, editor, Proceedings of the 2006 ACM SIGPLAN Workshop on Haskell, Portland, Oregon, USA, September 17, 2006, pages 37--47. ACM Press,

Re: [Haskell-cafe] Has anyone looked into adding subtyping to Haskell?

2007-05-31 Thread Thomas Schilling
I bring this up because I have been working on a Scheme compiler in Haskell for fun, and something like polymorphic variants would be quite convinent to allow you to specify versions of the AST (input ast, after closure conversion, after CPS transform, etc.), but allow you to write functions that

Re: [Haskell-cafe] equations and patterns

2007-05-31 Thread Henning Thielemann
On Thu, 31 May 2007, Stefan Holdermans wrote: Mingli, class Lattice e where join :: e - e - e meet :: e - e - e -- associative law join x (join y z) = join (join x y) z join (join x y) z = join x (join y z) If you are not to sell your soul to

Re: [Haskell-cafe] Has anyone looked into adding subtyping to Haskell?

2007-05-31 Thread Jon Harrop
On Thursday 31 May 2007 15:36:13 Al Falloon wrote: I bring this up because I have been working on a Scheme compiler in Haskell for fun, and something like polymorphic variants would be quite convinent to allow you to specify versions of the AST (input ast, after closure conversion, after CPS

Re: [Haskell-cafe] Implementing Mathematica

2007-05-31 Thread Jon Harrop
On Thursday 31 May 2007 11:39:14 [EMAIL PROTECTED] wrote: ... Mathematica changed a bit the perspective, along - perhaps - the same lines as Schoonschip, where the fundamental stuff was *rewriting/ transformations*. So, Mathematica since the begininng was equipped with a very powerful

[Haskell-cafe] Re: Has anyone looked into adding subtyping to Haskell?

2007-05-31 Thread apfelmus
Al Falloon wrote: OCaml has been getting a lot of mileage from its polymorphic variants (which allow structural subtyping on sum types) especially on problems relating to AST transformations and the infamous expression problem. Has there been any work on extending Haskell's type system with

Re: [Haskell-cafe] Has anyone looked into adding subtyping to Haskell?

2007-05-31 Thread Al Falloon
Mark T.B. Carroll wrote: I don't know what the infamous expression problem is, nor am I familiar with polymorphic variants or structural subtyping, but have you looked at the Data.Generics.* stuff and Scrap Your Boilerplate papers? They may be relevant. The expression problem is a new name

Re: [Haskell-cafe] Re: Has anyone looked into adding subtyping to Haskell?

2007-05-31 Thread Jules Bean
apfelmus wrote: Al Falloon wrote: OCaml has been getting a lot of mileage from its polymorphic variants (which allow structural subtyping on sum types) especially on problems relating to AST transformations and the infamous expression problem. Has there been any work on extending Haskell's

[Haskell-cafe] Re: Has anyone looked into adding subtyping to Haskell?

2007-05-31 Thread Al Falloon
apfelmus wrote: Al Falloon wrote: OCaml has been getting a lot of mileage from its polymorphic variants (which allow structural subtyping on sum types) especially on problems relating to AST transformations and the infamous expression problem. Has there been any work on extending Haskell's

[Haskell-cafe] Parse error on input |

2007-05-31 Thread Akijmo
Hi everyone. I am new to this Forum, Haskell and i am german, so i am sorry for noob failures or spelling mistakes. I am currently learning for an informatic exam (11th class) and i tried to code a function to sum a polynom with a pair of polynoms... (I actually want to to code a polynomdivision

[Haskell-cafe] Re: Has anyone looked into adding subtyping to Haskell?

2007-05-31 Thread Al Falloon
Thomas Schilling wrote: I bring this up because I have been working on a Scheme compiler in Haskell for fun, and something like polymorphic variants would be quite convinent to allow you to specify versions of the AST (input ast, after closure conversion, after CPS transform, etc.), but allow

[Haskell-cafe] Re: Has anyone looked into adding subtyping to Haskell?

2007-05-31 Thread Al Falloon
Jon Harrop wrote: On Thursday 31 May 2007 15:36:13 Al Falloon wrote: I bring this up because I have been working on a Scheme compiler in Haskell for fun, and something like polymorphic variants would be quite convinent to allow you to specify versions of the AST (input ast, after closure

Re: [Haskell-cafe] Parse error on input |

2007-05-31 Thread Robin Green
You neglected a ) - remember to count your parentheses in future when you get an error directly after a parenthesised expression. -- Robin On Thu, 31 May 2007 08:09:23 -0700 (PDT) Akijmo [EMAIL PROTECTED] wrote: Hi everyone. I am new to this Forum, Haskell and i am german, so i am sorry

[Haskell-cafe] small hack on hasktags to make it collect class names

2007-05-31 Thread Marc Weber
You can download the modified version from http://mawercer.de/marcweber/hasktags.hs Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Re: Has anyone looked into adding subtyping to Haskell?

2007-05-31 Thread Al Falloon
Stefan Holdermans wrote: Al, Has there been any work on extending Haskell's type system with structural subtyping? Koji Kagawaga. Polymorphic variants in Haskell. In Andres Loeh, editor, Proceedings of the 2006 ACM SIGPLAN Workshop on Haskell, Portland, Oregon, USA, September 17, 2006,

Re: [Haskell-cafe] Has anyone looked into adding subtyping to Haskell?

2007-05-31 Thread Dan Doel
On Thursday 31 May 2007, Al Falloon wrote: OCaml has been getting a lot of mileage from its polymorphic variants (which allow structural subtyping on sum types) especially on problems relating to AST transformations and the infamous expression problem. Has there been any work on extending

[Haskell-cafe] Re: Has anyone looked into adding subtyping to Haskell?

2007-05-31 Thread Jon Harrop
On Thursday 31 May 2007 17:46:38 Al Falloon wrote: I kind of saw the overlapping enumeration case as just a common special case of the AST problem. Theoretically, yes. In practice, this is quite an important distinction because enumerations do not suffer from the obfuscated error messages

Re: [Haskell-cafe] Network.HTTP+ByteStrings Interface--Or: How to shepherd handles and go with the flow at the same time?

2007-05-31 Thread Alex Jacobson
The HAppS HTTP code basically delivers the first 64k and a handle to acquire the rest. The 99% or higher case is that the document fits in memory so the 64k bound is fine. If you have something bigger, the user is going to have to decide how to handle that on a case by case basis. Note:

Re: [Haskell-cafe] Parse error on input |

2007-05-31 Thread Dan Weston
The second argument of the second line of the definition does not match the expected type. (Polynom,Polynom) is a tuple, not a list, so []::(a,a) is not well typed for any a. Dan Akijmo wrote: Hi everyone. I am new to this Forum, Haskell and i am german, so i am sorry for noob failures or

[Haskell-cafe] Monads and constraint satisfaction problems (CSP)

2007-05-31 Thread Greg Meredith
All, All this talk about Mathematica and a reference to monadic treatments of backtracking reminded me that a year ago i was involved in work on a Mathematica-like widget. At the time i noticed that a good deal of the structure underlying LP, SAT and other solvers was terribly reminiscent of

Re: [Haskell-cafe] Monads and constraint satisfaction problems (CSP)

2007-05-31 Thread Brandon Michael Moore
On Thu, May 31, 2007 at 10:42:57AM -0700, Greg Meredith wrote: All, All this talk about Mathematica and a reference to monadic treatments of backtracking reminded me that a year ago i was involved in work on a Mathematica-like widget. At the time i noticed that a good deal of the structure

Re: [Haskell-cafe] Parse error on input |

2007-05-31 Thread Akijmo
thx much green... this helped for the parser failure. Dan you were right too, cause now i got the interfering types [(Int,Int)] and Polynom for line 2. But i fixed this by replacing it with ([],[]) So thx much guys :D greenrd wrote: You neglected a ) - remember to count your parentheses in

Re: [Haskell-cafe] Monads and constraint satisfaction problems (CSP)

2007-05-31 Thread Jeremy Shaw
At Thu, 31 May 2007 10:42:57 -0700, Greg Meredith wrote: BTW, i think this could have a lot of bang-for-buck because the literature i read exhibited two basic features: - the standard treatments (even by CS-types) are decidedly not compositional - the people in the field who face

Re: [Haskell-cafe] Monads and constraint satisfaction problems (CSP)

2007-05-31 Thread Jeremy Shaw
At Thu, 31 May 2007 11:36:55 -0700, Jeremy Shaw wrote: This paper describes a non-monadic, compositional method for solving CSPs: http://www.cse.ogi.edu/PacSoft/publications/2001/modular_lazy_search_jfp.pdf btw, there are multiple versions of this paper. This version includes a section on

Re: [Haskell-cafe] Re: Has anyone looked into adding subtyping to Haskell?

2007-05-31 Thread Tomasz Zielonka
On Thu, May 31, 2007 at 06:16:20PM +0100, Jon Harrop wrote: I can't think of a lightweight way to encode overlapping enumerations in Haskell. I'd like to know if this is possible in Haskell. Maybe this way using GADTs and typeclasses? I haven't used such code in practice - there may be

Re: [Haskell-cafe] Re: Has anyone looked into adding subtyping to Haskell?

2007-05-31 Thread Tomasz Zielonka
On Thu, May 31, 2007 at 09:04:30PM +0200, Tomasz Zielonka wrote: On Thu, May 31, 2007 at 06:16:20PM +0100, Jon Harrop wrote: I can't think of a lightweight way to encode overlapping enumerations in Haskell. I'd like to know if this is possible in Haskell. Maybe this way using GADTs

Re: [Haskell-cafe] Frisby grammars that have context

2007-05-31 Thread Carl Witty
On Tue, 2007-05-29 at 10:18 -0400, Mark T.B. Carroll wrote: I've been playing with Text.Parsers.Frisby to see how it stacks against other options and, while it's been great so far, I am finding that I can't encode a grammar where what's acceptable depends on what's already been parsed in some

[Haskell-cafe] Just for a laugh...

2007-05-31 Thread Andrew Coppin
If you're bored... can you come up with a solution to this? http://warp.povusers.org/ProgrammingChallenge.html (Obviously a pretty silly challenge, but hey.) My first instinct was to use Data.Bits - but I see no instance for Double. (Presumably because performing bitwise operations on a

Re: [Haskell-cafe] Implementing Mathematica

2007-05-31 Thread Andrew Coppin
Lennart Augustsson wrote: Why do you seem so in awe of Mathematica? Oh, well, I guess it is only the most powerful maths software ever written... no biggie. It's just another language with a good set of libraries. Claims that it is the best, fastest, etc comes from Wolfram advertising, no

Re: [Haskell-cafe] Implementing Mathematica

2007-05-31 Thread Andrew Coppin
Jon Harrop wrote: If you write a simple, numerically-intensive program that runs in the Mathematica rewriter then its performance is about 100-1,000x slower than that of a native-code compiled language like Haskell. Mathematica is often 30x slower than interpreted OCaml bytecode. Is this

Re: [Haskell-cafe] Just for a laugh...

2007-05-31 Thread David House
On 31/05/07, Andrew Coppin [EMAIL PROTECTED] wrote: If you're bored... can you come up with a solution to this? Try using floatToDigits: http://haskell.org/ghc/docs/latest/html/libraries/base/Numeric.html#v%3AfloatToDigits floatToDigits takes a base and a non-negative RealFloat number, and

Re: [Haskell-cafe] Implementing Mathematica

2007-05-31 Thread Andrew Coppin
[EMAIL PROTECTED] wrote: The conditions of its career were far from obvious. The World had many symbolic math packages: Reduce, Macsyma, Schoonschip (beloved by high- energy physicists), Maple, Scratchpad2/Axiom, later MuSIMP/MuMATH for small platforms, etc. I find that statement interesting.

Re: [Haskell-cafe] Just for a laugh...

2007-05-31 Thread Tomasz Zielonka
On Thu, May 31, 2007 at 08:47:28PM +0100, Andrew Coppin wrote: If you're bored... can you come up with a solution to this? http://warp.povusers.org/ProgrammingChallenge.html (Obviously a pretty silly challenge, but hey.) I fail to see what this has to do with expressive power, which it's

[Haskell-cafe] Re: Just for a laugh...

2007-05-31 Thread Jon Fairbairn
David House [EMAIL PROTECTED] writes: On 31/05/07, Andrew Coppin [EMAIL PROTECTED] wrote: If you're bored... can you come up with a solution to this? Try using floatToDigits: http://haskell.org/ghc/docs/latest/html/libraries/base/Numeric.html#v%3AfloatToDigits floatToDigits takes a base

Re: [Haskell-cafe] Just for a laugh...

2007-05-31 Thread Andrew Coppin
Tomasz Zielonka wrote: On Thu, May 31, 2007 at 08:47:28PM +0100, Andrew Coppin wrote: If you're bored... can you come up with a solution to this? http://warp.povusers.org/ProgrammingChallenge.html (Obviously a pretty silly challenge, but hey.) I fail to see what this has to do with

Re: [Haskell-cafe] Re: Just for a laugh...

2007-05-31 Thread Andrew Coppin
Jon Fairbairn wrote: David House [EMAIL PROTECTED] writes: On 31/05/07, Andrew Coppin [EMAIL PROTECTED] wrote: If you're bored... can you come up with a solution to this? Try using floatToDigits:

Re: [Haskell-cafe] OpenGL

2007-05-31 Thread Andrew Coppin
Creighton Hogg wrote: Check out this blog entry as a nice starting place http://blog.mikael.johanssons.org/archive/2006/09/opengl-programming-in-haskell-a-tutorial-part-1/ Thanks for this... (I too would like to start hacking around with OpenGL!)

Re: [Haskell-cafe] Re: New book: Real-World Haskell!

2007-05-31 Thread Andrew Coppin
Malte Milatz wrote: Simon Marlow: While we're on fish, what's wrong with the humble Haddock? :-) It may at least make for a tasty curry ... Oh dear God, what next? Will you say a blessing over the food in a *Church*? ___ Haskell-Cafe

Re: [Haskell-cafe] What puts False before True?

2007-05-31 Thread Brandon Michael Moore
On Thu, May 31, 2007 at 10:03:05AM +0100, PR Stanley wrote: What is the basic philosophy for Bool being a member of Ord? I hear two questions, why is Bool a member of Ord at all, and why was it ordered with False before True. If I'm reading the reports correctly, the Ord instance was

[Haskell-cafe] Re: Just for a laugh...

2007-05-31 Thread Jon Fairbairn
Andrew Coppin [EMAIL PROTECTED] writes: Jon Fairbairn wrote: David House [EMAIL PROTECTED] writes: On 31/05/07, Andrew Coppin [EMAIL PROTECTED] wrote: If you're bored... can you come up with a solution to this? Try using floatToDigits:

Re: [Haskell-cafe] Re: Just for a laugh...

2007-05-31 Thread David House
On 31/05/07, Andrew Coppin [EMAIL PROTECTED] wrote: Note that the challenge asks for the internal bitmap representation of an IEEE double-precision integer - not the mathematical binary expansion. (In particular, things like Infinity and NaN have special bit sequences.) Ah, sorry, then

Re: [Haskell-cafe] Just for a laugh...

2007-05-31 Thread Dan Doel
On Thursday 31 May 2007, Andrew Coppin wrote: If you're bored... can you come up with a solution to this? http://warp.povusers.org/ProgrammingChallenge.html (Obviously a pretty silly challenge, but hey.) With some help from int-e in irc: {-# OPTIONS_GHC -fglasgow-exts #-} import GHC.Base

[Haskell-cafe] Existentials and type var escaping

2007-05-31 Thread Roberto Zunino
In this function data C = C Int foo :: C - C foo ~(C x) = C x foo is _not_ the identity: its result must be non bottom, i.e. the constructor C is forced to its argument. I wonder if a similar function is definable for existential types: data E = forall a . E a foo :: E - E foo, as defined

Re: [Haskell-cafe] Just for a laugh...

2007-05-31 Thread John Meacham
On Thu, May 31, 2007 at 08:47:28PM +0100, Andrew Coppin wrote: My first instinct was to use Data.Bits - but I see no instance for Double. (Presumably because performing bitwise operations on a Double is a pretty odd thing to want to do.) So my next guess is to do some bizzare type system

Re: [Haskell-cafe] Re: Just for a laugh...

2007-05-31 Thread Dougal Stanton
On 31 May 2007 21:52:33 +0100, Jon Fairbairn [EMAIL PROTECTED] wrote: Yes, but you didn't say that it's not only silly but demonstrates the opposite of expressiveness as it's all about breaking an abstraction and must be non-portable code (because it's definition is that it won't give the same

Re: [Haskell-cafe] Just for a laugh...

2007-05-31 Thread Tomasz Zielonka
On Thu, May 31, 2007 at 08:47:28PM +0100, Andrew Coppin wrote: If you're bored... can you come up with a solution to this? http://warp.povusers.org/ProgrammingChallenge.html (Obviously a pretty silly challenge, but hey.) My first instinct was to use Data.Bits - but I see no instance for

Re: [Haskell-cafe] Existentials and type var escaping

2007-05-31 Thread David House
On 31/05/07, Isaac Dupree [EMAIL PROTECTED] wrote: foo undefined = undefined That's not true. When you evaluate foo undefined, it matches the first (irrefutable) pattern immediately, without any deconstruction of the undefined argument (which is the entire point of it being a lazy pattern). So

[Haskell-cafe] Re: Monads and constraint satisfaction problems (CSP)

2007-05-31 Thread Greg Meredith
Brandon, Jeremy, et al, Thanks for the pointers. The paper by OlegK, et al, articulates exactly the structure i was noticing, except that i was coming at it from the other end. i was noticing that a wide range of these CSP-style problems could be decomposed into a trivial monad (e.g., list,

Re: [Haskell-cafe] Existentials and type var escaping

2007-05-31 Thread Isaac Dupree
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Roberto Zunino wrote: In this function data C = C Int foo :: C - C foo ~(C x) = C x foo is _not_ the identity: its result must be non bottom, i.e. the constructor C is forced to its argument. foo undefined = undefined foo (C undefined) = C

Re: [Haskell-cafe] Implementing Mathematica

2007-05-31 Thread jerzy . karczmarczuk
Andrew Coppin cites me and asks: jk wrote: ... The World had many symbolic math packages: Reduce, Macsyma, Schoonschip (beloved by high- energy physicists), Maple, Scratchpad2/Axiom, later MuSIMP/MuMATH for small platforms, etc. I find that statement interesting. I have never come across

Re: [Haskell-cafe] Implementing Mathematica

2007-05-31 Thread Tim Newsham
OK, so you're saying that in 4 days you wrote something that out-performs Mathematica, a program that has existed for decades and has a vast, highly-funded RD effort behind it featuring some of the brightest minds in the field? If you want some amusement, just search for Jon Harrop in

Re: [Haskell-cafe] Crazy idea: overloading function application notation

2007-05-31 Thread Derek Elkins
Claus Reinke wrote: This is a crazy idea I've been working on: overload the syntax x y so it can mean function application f x = f(x) or multiplication x y = x*y. The reason is simply that I appreciate the brevity of MLs function application but I also appreciate the brevity of Mathematica's

Re: [Haskell-cafe] Just for a laugh...

2007-05-31 Thread Brandon S. Allbery KF8NH
On May 31, 2007, at 15:47 , Andrew Coppin wrote: If you're bored... can you come up with a solution to this? http://warp.povusers.org/ProgrammingChallenge.html Is it me, or does this look like a job for Data.Binary? -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] [EMAIL

Re: [Haskell-cafe] Just for a laugh...

2007-05-31 Thread Creighton Hogg
On 5/31/07, Brandon S. Allbery KF8NH [EMAIL PROTECTED] wrote: On May 31, 2007, at 15:47 , Andrew Coppin wrote: If you're bored... can you come up with a solution to this? http://warp.povusers.org/ProgrammingChallenge.html Is it me, or does this look like a job for Data.Binary? It's not

Re: [Haskell-cafe] Crazy idea: overloading function application notation

2007-05-31 Thread jerzy . karczmarczuk
Derek Elkins after a long chain which began: This is a crazy idea I've been working on: overload the syntax x y so it can mean function application f x = f(x) or multiplication x y = x*y. ... This change would -definitely- lead to massive ambiguity and potentially lead to unresolvable

Re: [Haskell-cafe] Just for a laugh...

2007-05-31 Thread David Roundy
On Thu, May 31, 2007 at 11:36:54PM +0200, Tomasz Zielonka wrote: You can imitate the C++ code using the FFI libraries: import Foreign.Storable import Foreign import Data.Word import Data.Bits getDoubleBits :: Double - IO String getDoubleBits d = alloca $ \ptr -

Re: [Haskell-cafe] Implementing Mathematica

2007-05-31 Thread jerzy . karczmarczuk
Jon Harrop after myself: The semantic pattern-matcher within an algebraic package, is worlds apart from the syntactic/structural pattern-matcher of Haskell. Can you elaborate on this? I would imagine that the pattern matcher in a term-level Haskell interpreter would be quite similar to

Re: [Haskell-cafe] RE: [Haskell] boilerplate boilerplate

2007-05-31 Thread Alex Jacobson
Actually, standalone deriving doesn't really solve the boilerplate boilerplate problem. My original complaint here is that I don't want to explicitly declare a deriving (Data,Typeable) for every type used somewhere inside a larger type I am using. In this particular case, I am using SYB to

Re: [Haskell-cafe] Has anyone looked into adding subtyping to Haskell?

2007-05-31 Thread Donald Bruce Stewart
stefan: Al, Has there been any work on extending Haskell's type system with structural subtyping? Koji Kagawaga. Polymorphic variants in Haskell. In Andres Loeh, editor, Proceedings of the 2006 ACM SIGPLAN Workshop on Haskell, Portland, Oregon, USA, September 17, 2006, pages

Re: [Haskell-cafe] What puts False before True?

2007-05-31 Thread Steve Schafer
On Thu, 31 May 2007 13:51:20 -0700, you wrote: I think it's mathematical convention more than the C convention Haskell is agreeing with. I think so, too. In Boolean algebra (which predates computers, much less C), FALSE has traditionally been associated with 0, and TRUE with 1. And since 1 0,

Re: [Haskell-cafe] What puts False before True?

2007-05-31 Thread PR Stanley
I think it's mathematical convention more than the C convention Haskell is agreeing with. I think so, too. In Boolean algebra (which predates computers, much less C), FALSE has traditionally been associated with 0, and TRUE with 1. And since 1 0, TRUE FALSE. The question, however, still

[Haskell-cafe] New (?) Partial Monad

2007-05-31 Thread Christopher Lane Hinson
Some time ago I noticed that a function I was writing had the exact type as liftM2, and I so I ended up generalizing a monad. I thought I should document it really well, and the result is this: http://www.downstairspeople.org/darcs/partial/Partial.pdf $ darcs get

Re: [Haskell-cafe] Re: Has anyone looked into adding subtyping to Haskell?

2007-05-31 Thread Jason Dagit
On 5/31/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Polymorphic extensible records with subtyping are already expressible in Haskell. There is nothing needs to be added: http://homepages.cwi.nl/~ralf/HList/ http://homepages.cwi.nl/~ralf/OOHaskell/ The last time I tried

[Haskell-cafe] Re: Has anyone looked into adding subtyping to Haskell?

2007-05-31 Thread oleg
Polymorphic extensible records with subtyping are already expressible in Haskell. There is nothing needs to be added: http://homepages.cwi.nl/~ralf/HList/ http://homepages.cwi.nl/~ralf/OOHaskell/ The full code is available via darcs http://darcs.haskell.org/OOHaskell/

Re: [Haskell-cafe] What puts False before True?

2007-05-31 Thread Paul Hudak
PR Stanley wrote: I think so, too. In Boolean algebra (which predates computers, much less C), FALSE has traditionally been associated with 0, and TRUE with 1. And since 1 0, TRUE FALSE. The question, however, still remains: why False = 0 and True 1? I appreciate that it's so in boolean

Re: [Haskell-cafe] What puts False before True?

2007-05-31 Thread Steve Schafer
On Fri, 01 Jun 2007 03:33:41 +0100, you wrote: The question, however, still remains: why False = 0 and True 1? I appreciate that it's so in boolean algebra but why? Why not True = 0 and False = 1? There is a correspondence between a Boolean algebra and an algebraic ring. If we identify 0 with

Re: [Haskell-cafe] Implementing Mathematica

2007-05-31 Thread Jon Harrop
On Thursday 31 May 2007 20:56:47 Andrew Coppin wrote: Jon Harrop wrote: If you write a simple, numerically-intensive program that runs in the Mathematica rewriter then its performance is about 100-1,000x slower than that of a native-code compiled language like Haskell. Mathematica is

  1   2   >