Re[2]: [Haskell-cafe] Haskell wiki: most popular pages

2006-08-19 Thread Bulat Ziganshin
Hello Tim, Friday, August 18, 2006, 8:23:16 PM, you wrote: I agree with that. The and = ... wasn't really an improvement over and xs = ... xs, and if the later is easier to read that's good. the main goal here is readability, of course What happened to isSpace, toLower and toUpper (, from

Re[2]: [Haskell-cafe] C++ class = neutered (haskell class + haskellexistential)

2006-08-19 Thread Bulat Ziganshin
Hello Brian, Friday, August 18, 2006, 8:54:08 PM, you wrote: http://haskell.org/haskellwiki/OOP_vs_type_classes although i mentioned not only pluses but also drawbacks of type classes: lack of record extension mechanisms (such at that implemented in O'Haskell) and therefore inability to reuse

[Haskell-cafe] A backwards-compatible record proposal

2006-08-19 Thread Brian Hulley
Hi - As I've been writing a Haskell program over the past few months the main problem I encounter is that record field names are not local to the record type, and any systematic way of making them local (eg by prepending _Tycon_) results in names that are just too clunky, and I feel that

[Haskell-cafe] Re: iterative algorithms: how to do it in Haskell?

2006-08-19 Thread Gene A
Hi, Here is a little thing I came up with to simulate the construct for x:= n1 to n2 and for x:=n1 to n2 by n3 from purely imperative world to use in Haskell, I call the functions fromto and fromtoby.. they also take a function which consumes the x component and uses it in the computation.

Re: [Haskell-cafe] A backwards-compatible record proposal

2006-08-19 Thread Brian Hulley
Brian Hulley wrote: In the module containing the data decl for the record, the compiler inserts the following: instance (.x) (Vector3 a) a where (.x) v = ... -- compiler generated code to access the field instance (.x) (Vector3 a) a where (.x) Vector3{.x = x} = x

Re: [Haskell-cafe] Re: iterative algorithms: how to do it in Haskell?

2006-08-19 Thread Henk-Jan van Tuyl
On Sat, 19 Aug 2006 10:28:33 +0200, Gene A [EMAIL PROTECTED] wrote: *Iteration fromtoby 1 12 2 (flip (^) 3) -- cubing of the base list above.. An easier way to write this: fromtoby 1 12 2 (^3) [...] *Iteration fromtoby 12 42 3 (flip (**) 0.33) fromtoby 12 42 3 (**0.33)

Re: [Haskell-cafe] automatic instance derivation

2006-08-19 Thread Bulat Ziganshin
Hello Greg, Saturday, August 19, 2006, 3:42:45 AM, you wrote: -- Is something like this possible? derive Show Val2 yes, in proposal :) well, the best practical way i know is to use Template Haskell / DrIFT. I can give your a TH module which generates Show instances. So, using it will as easy

Re: [Haskell-cafe] Haskell wiki: most popular pages

2006-08-19 Thread Tamas K Papp
On Fri, Aug 18, 2006 at 04:46:14PM +0400, Bulat Ziganshin wrote: Hello Tim, Friday, August 18, 2006, 4:26:46 PM, you wrote: break p = span (not . p) it's definitely better and = foldr () True i think that definitions with omitted arguments can be more hrd to understand to newbie

RE: [Haskell-cafe] HTTPS in Haskell

2006-08-19 Thread Pasqualino 'Titto' Assini
Hi Adam, I believe that this is simply to detect that the WASH CGI script is being invoked using HTTPS while running into a Web server (say Apache) that supports it. titto -Original Message- From: [EMAIL PROTECTED] [mailto:haskell-cafe- [EMAIL PROTECTED] On Behalf Of Adam Peacock

Re: [Haskell-cafe] A backwards-compatible record proposal

2006-08-19 Thread Bernard James POPE
On Sat, Aug 19, 2006 at 09:21:34AM +0100, Brian Hulley wrote: Therefore I think the desugaring would need to take place in the compiler so the compiler could avoid exporting the compiler-generated instances when the fields are not present in the module export list. I'm not entirely sure I

Re: [Haskell-cafe] Re: iterative algorithms: how to do it in Haskell?

2006-08-19 Thread Lennart Augustsson
On Aug 19, 2006, at 05:14 , Henk-Jan van Tuyl wrote: [...] *Iteration fromtoby 12 42 3 (flip (**) 0.33) fromtoby 12 42 3 (**0.33) And why approximate so much? fromtoby 12 42 3 (** (1/3)) ___ Haskell-Cafe mailing list

[Haskell-cafe] Re: iterative algorithms: how to do it in Haskell?

2006-08-19 Thread Gene A
Hi Lennart, This morning when I posted..it was about 2:30am and had been up a long time... bad habits.. I sent a message to Henk-Jan to that effect, but didn't send to the entire list.. anyway thanks to both for the followups... I still tend to sometimes do things the hard way in Haskell.

[Haskell-cafe] Problem getting started with graphics library in GHC on Windows

2006-08-19 Thread Tomi Maila
Hi, I'm a Haskell newbie. I've been studying Haskell by reading the book The Haskell School of Expression. Most of the example in the book use graphics library SOEGraphics. Windows GHC didn't find the library, but I assumed that the new name for the library is Graphics.SOE which seemed to

[Haskell-cafe] Useful: putCharLn {inspire by the Int-[Char] thread

2006-08-19 Thread Gene A
The thread on the use of show and print to display an Int value, brought up a problem I had early on... the one of cleanly displaying a Char value, on a line all by itself.. My first attempts: This was just plain hard to read: with the character t being where it was: Prelude putChar $ head this

Re: [Haskell-cafe] Useful: putCharLn {inspire by the Int-[Char] thread

2006-08-19 Thread Neil Mitchell
Hi c2Str c = c:[] This function is often known as box, its much more general than char to string, it puts any single element in a list like box Thanks Neil ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] Useful: putCharLn {inspire by the Int-[Char] thread

2006-08-19 Thread Niklas Broberg
c2Str c = c:[] This function is often known as box, its much more general than char to string, it puts any single element in a list like box ... or 'return', which is in the Prelude already, but which is even more general, it puts any single element into any (dare I say it) monad, where a

[Haskell-cafe] Re: iterative algorithms: how to do it in Haskell?

2006-08-19 Thread Lennart Augustsson
There are much better ways than storing strings on the stack. Like using a data type with constructors for the different types that you can store. -- Lennart On Aug 19, 2006, at 11:51 , Gene A wrote: Hi Lennart, This morning when I posted..it was about 2:30am and had been up a long

[Haskell-cafe] Re: A backwards-compatible record proposal

2006-08-19 Thread Brian Hulley
Gene A wrote: On 8/19/06, Brian Hulley [EMAIL PROTECTED] wrote: {... magSquared v = v.x*v.x + v.y*v.y + v.z*v.z ...} Hi, Won't the use of the dot lend confusion to the eye of the beholder.. that as in the code fragment about that v.y or v.z is implying function composition I'll admit to

Re: [Haskell-cafe] Useful: putCharLn {inspire by the Int-[Char] thread

2006-08-19 Thread Henk-Jan van Tuyl
On Sat, 19 Aug 2006 19:21:36 +0200, Gene A [EMAIL PROTECTED] wrote: [...] Prelude putStrLn $ (head this and that):[] Or you could use: putStrLn [head This and that] -- Met vriendelijke groet, Henk-Jan van Tuyl -- http://Van.Tuyl.eu/ -- Using Opera's revolutionary e-mail client:

Re: [Haskell-cafe] automatic instance derivation

2006-08-19 Thread Greg Fitzgerald
well, the best practical way i know is to use Template Haskell / DrIFTThat's too bad. I was hoping we could trivially solve Tim Newsham's XML problem by importing HaXml, automatically deriving Data and Typeable for HaXml's 'Content' data type, and then use 'everywhereM' from

Re: [Haskell-cafe] A backwards-compatible record proposal

2006-08-19 Thread Brian Hulley
Bernard James POPE wrote: On Sat, Aug 19, 2006 at 09:21:34AM +0100, Brian Hulley wrote: Therefore I think the desugaring would need to take place in the compiler so the compiler could avoid exporting the compiler-generated instances when the fields are not present in the module export list.

Re: [Haskell-cafe] A backwards-compatible record proposal

2006-08-19 Thread Brian Hulley
Ooops! ;-) Brian Hulley wrote: module M (Rec, use) where import DotClasses.Dot_f-- every class has its own module (*) data Rec' a = Rec a newtype Rec a = Rec (Rec' a) instance Dot__f (Rec' a) a where instance Dot_f (Rec' a) a where __dot_f (Rec' x) = x

Re: [Haskell-cafe] A backwards-compatible record proposal

2006-08-19 Thread Brian Hulley
Brian Hulley wrote: However I think it could be solved by a more complex desugaring: The proposed desugarings allow us to either make all dotted fields in a record visible, or none of them visible, but I don't think there exists a desugaring that would allow some to be visible while others

Re: [Haskell-cafe] rand* why not of type State g a

2006-08-19 Thread Henning Thielemann
On Sun, 13 Aug 2006, Marc Weber wrote: the rand* function are examples for a typical state usage, arent' they? Is there any reasoon why they are not defined RandomGen g = State g a rather than RandomGen g = (a,a) - g - (a,g) ? It's probably because Control.Monad.State belongs to the

Re: [Haskell-cafe] rand* why not of type State g a

2006-08-19 Thread David Menendez
Henning Thielemann writes: On Sun, 13 Aug 2006, Marc Weber wrote: the rand* function are examples for a typical state usage, arent' they? Is there any reasoon why they are not defined RandomGen g = State g a rather than RandomGen g = (a,a) - g - (a,g) ? It's probably

Re: [Haskell-cafe] C++ class = neutered (haskell class + haskell existential)

2006-08-19 Thread Gabriel Dos Reis
John Meacham [EMAIL PROTECTED] writes: | On Tue, Aug 15, 2006 at 08:36:28PM +0200, Gabriel Dos Reis wrote: | Roughly Haskell type classes correspond to parameterized abstract | classes in C++ (i.e. class templates with virtual functions | representing the operations). Instance declarations

Re: Re[2]: [Haskell-cafe] C++ class = neutered (haskell class + haskell existential)

2006-08-19 Thread Gabriel Dos Reis
Bulat Ziganshin [EMAIL PROTECTED] writes: | Hello Thomas, | | Friday, August 18, 2006, 7:57:13 AM, you wrote: | | There is a major difference though, in C++ (or java, or sather, or c#, | etc..) the dictionary is always attached to the value, the actual class | data type you pass around. in

Re: [Haskell-cafe] C++ class = neutered (haskell class + haskell existential)

2006-08-19 Thread Gabriel Dos Reis
Bulat Ziganshin [EMAIL PROTECTED] writes: | Hello John, | | Friday, August 18, 2006, 5:16:45 AM, you wrote: | | There is a major difference though, in C++ (or java, or sather, or c#, | etc..) the dictionary is always attached to the value, the actual class | data type you pass around. in