Fw: [Haskell-cafe] A restricted subset of CPP included in a revisionof Haskell 98

2006-08-22 Thread Brian Hulley
Hi - here is an exchange that was off-list by accident: Original Message From: Brian Smith To: Brian Hulley Sent: Tuesday, August 22, 2006 5:50 AM (Brian, I see that my last reply only went to you and so I forwarded it to the list. Since you replied to me directly, I am responding to

[Haskell-cafe] implementing a csv reader

2006-08-22 Thread Tamas K Papp
Hi, Now that I have read the tutorials, I think that the best way to learn Haskell would be to use the language and write something simple yet useful. I noticed that Haskell lacks a module for reading/writing csv (comma separated value) files, so I thought I could implement that. Questions: 1.

Re: [Haskell-cafe] implementing a csv reader

2006-08-22 Thread Henning Thielemann
On Tue, 22 Aug 2006, Tamas K Papp wrote: Hi, Now that I have read the tutorials, I think that the best way to learn Haskell would be to use the language and write something simple yet useful. I noticed that Haskell lacks a module for reading/writing csv (comma separated value) files, so

Re: [Haskell-cafe] Writing binary files

2006-08-22 Thread Alistair Bayley
On 21/08/06, Udo Stenzel [EMAIL PROTECTED] wrote: Neil Mitchell wrote: I'm trying to write out a binary file, in particular I want the following functions: hPutInt :: Handle - Int - IO () hGetInt :: Handle - IO Int For the purposes of these functions, Int = 32 bits, and its got to

RE: [Haskell-cafe] implementing a csv reader

2006-08-22 Thread Pasqualino 'Titto' Assini
Check first MissingH. I remember that it came with some parsing routines for common text formats. Best, Titto -Original Message- From: [EMAIL PROTECTED] [mailto:haskell-cafe- [EMAIL PROTECTED] On Behalf Of Tamas K Papp Sent: 22 August 2006 10:20 To: Haskell Cafe Subject:

Re: [Haskell-cafe] implementing a csv reader

2006-08-22 Thread Jens Fisseler
Hi Tamas, Questions: 1. Please tell me if you know of a csv module, because then I would do something else. I think MissingH contains a simple CSV parser, but the server seems to be down. 2. I am looking for a parser, but I don't know Haskell parsers. Is Parsec a good choice?

Re: [Haskell-cafe] implementing a csv reader

2006-08-22 Thread Tamas K Papp
On Tue, Aug 22, 2006 at 11:26:45AM +0200, Henning Thielemann wrote: See also http://www.xoltar.org/languages/haskell.html http://www.xoltar.org/languages/haskell/CSV.hs Thanks. Haskell is incredibly neat ;-) Now I need to find something else for practice. Is there anything

Re: [Haskell-cafe] implementing a csv reader

2006-08-22 Thread Eric Kow
Now I need to find something else for practice. How about writing a CiteULike plugin? For example, what could be really useful is if somebody wrote one for the French open archive HAL. This will give you a nice chance to play maybe with parsing stuff, or one of the HTML/XML libraries, or

Re[2]: [Haskell-cafe] implementing a csv reader

2006-08-22 Thread Bulat Ziganshin
Hello Tamas, Tuesday, August 22, 2006, 1:59:28 PM, you wrote: Now I need to find something else for practice. Is there anything related to data analysis/statistics that is lacking is Haskell? general String/List library containing search, replace, split and all other general algorithms --

Re[2]: [Haskell-cafe] Writing binary files

2006-08-22 Thread Bulat Ziganshin
Hello Alistair, Tuesday, August 22, 2006, 1:29:22 PM, you wrote: What's wrong with the following i.e. what assumptions is it making (w.r.t. pointers) that I've missed? Is endian-ness an issue here? data written by your module on big-endian machine, can't be read by the same module in the

Re: class [] proposal Re: [Haskell-cafe] One thought: Num to 0 as ? to list?

2006-08-22 Thread Malcolm Wallace
Bulat Ziganshin [EMAIL PROTECTED] wrote: 2) allow to use type classes in type declarations like the types itself. for example, allow the following: f :: Num a = a - Int write as f :: Num - Int and following: sequence :: Monad m = [m a] - m [a] write as sequence :: [Monad a] - Monad

Re[2]: class [] proposal Re: [Haskell-cafe] One thought: Num to 0 as ? to list?

2006-08-22 Thread Bulat Ziganshin
Hello Malcolm, Tuesday, August 22, 2006, 4:22:50 PM, you wrote: 2) allow to use type classes in type declarations like the types itself. for example, allow the following: f :: Num a = a - Int write as f :: Num - Int and following: sequence :: Monad m = [m a] - m [a] write as

Re: Re[2]: class [] proposal Re: [Haskell-cafe] One thought: Num to 0 as ? to list?

2006-08-22 Thread Bryan Burgers
On 8/22/06, Bulat Ziganshin [EMAIL PROTECTED] wrote: what i propose is not full replacement of existing syntax - quite the contrary it is just a syntax sugar for most frequent cases of using classes in function signatures. the key idea is that in most cases we use only one type class for each

Re: Re[2]: class [] proposal Re: [Haskell-cafe] One thought: Num to 0as ? to list?

2006-08-22 Thread Brian Hulley
Bulat Ziganshin wrote: f :: Num a = a - Int write as f :: Num - Int so, while this proposal is rather minor, i think that it is Good thing I wouldn't like it because I'd like to eventually make the class namespace separate from the tycon namespace so that I could write: class Object a

Re: Re[2]: class [] proposal Re: [Haskell-cafe] One thought: Num to0as ? to list?

2006-08-22 Thread Brian Hulley
Brian Hulley wrote: Bulat Ziganshin wrote: f :: Num a = a - Int write as f :: Num - Int Actually separating the class namespace from the tycon namespace would allow you to get a very similar effect to the use of abstract interfaces in C++ ie: class Object a where name :: a -

Re: Re[2]: class [] proposal Re: [Haskell-cafe] One thought: Numto0as ? to list?

2006-08-22 Thread Brian Hulley
Brian Hulley wrote: -- generated automatically? data Object = forall a. Object a Ooops! ;-) data Object = forall a. Object a = Object a ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: Re[2]: class [] proposal Re: [Haskell-cafe] One thought: Num to0as ? to list?

2006-08-22 Thread Brian Hulley
Brian Hulley wrote: Bulat Ziganshin wrote: f :: Num a = a - Int write as f :: Num - Int so, while this proposal is rather minor, i think that it is Good thing I wouldn't like it because I'd like to eventually make the class namespace separate from the tycon namespace... Apologies for that

Re: class [] proposal Re: [Haskell-cafe] One thought: Num to 0 as ? to list?

2006-08-22 Thread Arie Peterson
Hello Bryan, On 2006-08-22, Bryan Burgers [EMAIL PROTECTED] wrote: so, while this proposal is rather minor, i think that it is Good thing I disagree. As a new learner to Haskell, I already have a hard time keeping Constructors, Types, and Classes straight. I know what they all are and what

Re: [Haskell-cafe] implementing a csv reader

2006-08-22 Thread Jared Updike
Now I need to find something else for practice. Is there anything related to data analysis/statistics that is lacking is Haskell? A native implementation of multiparameter data fitting (requires some linear algebra) like: Sec 15.4 of http://www.library.cornell.edu/nr/bookcpdf.html or

RE: [Haskell-cafe] implementing a csv reader

2006-08-22 Thread Daan Leijen
2. I am looking for a parser, but I don't know Haskell parsers. Is Parsec a good choice? Parsec is definitely a good choice, but beware that it parses the whole input before returning, thus it may consume a huge batch of memory. As CSV is a line oriented format, you should make your

Re: class [] proposal Re: [Haskell-cafe] One thought: Num to 0 as ? to list?

2006-08-22 Thread Gene A
Arie said: {... This is an instance of a general conflict: should we sacrifice nice notation for ease of learning? You could make a similar case for list comprehensions, for example: they complicate matters for newcomers (yet another meaning of brackets and pipe) ...} I have to totally agree

Re: class [] proposal Re: [Haskell-cafe] One thought: Num to 0as ? to list?

2006-08-22 Thread Arie Peterson
Hello Brian and others, On 2006-08-22, Brian Hulley [EMAIL PROTECTED] wrote: I wouldn't like it because I'd like to eventually make the class namespace separate from the tycon namespace so that I could write: class Object a where ... data Object = forall a. Object a =

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

2006-08-22 Thread Gene A
John, Thanks very much for that bit of insight. I am not really writing anything right now that is in more hurry than what Haskell can handle nicely. I was feeling a bit guilty as, Shao said, I use $ over (.) and thought that my code could get some amount of ridicule as to style... when it gets

Re: class [] proposal Re: [Haskell-cafe] One thought: Num to 0 as ? to list?

2006-08-22 Thread Brandon Moore
Bulat Ziganshin wrote: Hello Malcolm, Tuesday, August 22, 2006, 4:22:50 PM, you wrote: 2) allow to use type classes in type declarations like the types itself. for example, allow the following: f :: Num a = a - Int write as f :: Num - Int and following: sequence :: Monad m = [m a] - m

Re[2]: class [] proposal Re: [Haskell-cafe] One thought: Num to 0as ? to list?

2006-08-22 Thread Bulat Ziganshin
Hello Arie, Tuesday, August 22, 2006, 8:24:17 PM, you wrote: data Object = forall a. Object a = Object a I like the idea of separating class and type constructor namespaces, and then being able to use existentials as in your example (although the latter would also belong in the category

Re[2]: class [] proposal Re: [Haskell-cafe] One thought: Num to 0 as ? to list?

2006-08-22 Thread Bulat Ziganshin
Hello Arie, Tuesday, August 22, 2006, 7:24:34 PM, you wrote: I disagree. As a new learner to Haskell, I already have a hard time keeping Constructors, Types, and Classes straight. I know what they all are and what they all do, but sometimes I really have to think hard to remember which is

Re: class [] proposal Re: [Haskell-cafe] One thought: Num to 0as ? to list?

2006-08-22 Thread Brian Hulley
Brandon Moore wrote: Perhaps there is something similar that could be done with type classes. In particular, I very much like Daan's rule of only inlining a constraint if the type it binds is only used once, which would mean Num - Num - Num would be equivalent to (Num a, Num b, Num c) = a - b

Re: [Haskell-cafe] DiffArray is an unsaturated type?

2006-08-22 Thread Bulat Ziganshin
Hello Neil, Monday, August 21, 2006, 7:23:41 PM, you wrote: type DiffArray = IOToDiffArray IOArray Is there any difference between the above definition and: type DiffArray a b = IOToDiffArray IOArray a b Is the first prefered for any reason? look at

Re: Re[2]: class [] proposal Re: [Haskell-cafe] One thought: Num to 0as ? to list?

2006-08-22 Thread Brian Hulley
Bulat Ziganshin wrote: from one my module: copyStream :: (BlockStream h1, BlockStream h2, Integral size) = h1 - h2 - size - IO () in my library and found the way to simplify most of their signatures: copyStream :: BlockStream* - BlockStream** - Integral - IO () i think that

Re[2]: class [] proposal Re: [Haskell-cafe] One thought: Num to 0as ? to list?

2006-08-22 Thread Bulat Ziganshin
Hello Brian, Tuesday, August 22, 2006, 9:35:21 PM, you wrote: I feel if it ain't broken don't fix it, and not only is the existing syntax not broken, it's already (imho) absolutely perfect in it's clarity and consistency it's because you not programmed a lot with type classes. if you start,

Re: [Haskell-cafe] Re: Memoizing longest-common-subsequence

2006-08-22 Thread Jared Updike
(Sorry for the late reply; have been on holiday.) No problem. Your email system was kind enough to say when you'd be back :-) I've used it to diff fairly large files (hundreds of K's, if not Megs) where there were few differences. It seemed to perform OK, and in cases where GNU diff (or

Re: Re[2]: class [] proposal Re: [Haskell-cafe] One thought: Num to 0as ? to list?

2006-08-22 Thread Brian Hulley
Bulat Ziganshin wrote: Hello Brian, Tuesday, August 22, 2006, 9:35:21 PM, you wrote: I feel if it ain't broken don't fix it, and not only is the existing syntax not broken, it's already (imho) absolutely perfect in it's clarity and consistency it's because you not programmed a lot with type

[Haskell-cafe] type synonym liberalization (was class [] proposal)

2006-08-22 Thread Brandon Moore
Bulat Ziganshin wrote: Subtyping introduced in very natural (at least for OOP souls) way. We may, for example, have functions: doit :: MemBuf - IO Int hRequestBuf :: MemoryStream - IO Int hTell :: SeekableStream - IO Integral and call doit - hRequestBuf - hTell and then return result, and all

Re: [Haskell-cafe] implementing a csv reader

2006-08-22 Thread Tomasz Zielonka
On Tue, Aug 22, 2006 at 08:59:40AM -0700, Daan Leijen wrote: 2. I am looking for a parser, but I don't know Haskell parsers. Is Parsec a good choice? Parsec is definitely a good choice, but beware that it parses the whole input before returning, thus it may consume a huge batch of

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

2006-08-22 Thread Gene A
Excerpt from Bulat Ziganshin : i think that definitions with omitted arguments can be more hrd to understand to newbie haskellers, especiallyones who not yet know the language. as Tamas suggests, this page can be used to present to such newbies taste of Haskell so listing all the parameters may

[Haskell-cafe] Re: type synonym liberalization (was class [] proposal)

2006-08-22 Thread Arie Peterson
Hello Brandon, This could be handled with existential wrappers, except that the wrapping is annoying, and probably interferes with optimizing when a concrete type is known. Instead, a few changes to type synonyms handle Bulat's cases. With the proper interpretation, type synonyms like

[Haskell-cafe] debugging space leaks in references

2006-08-22 Thread Andrew Pimlott
GHC's great space profiling tools don't appear to be much help when your leaked memory is stored in references (IORefs, StablePtrs, etc). I had a real-life case where the allocation profile showed me where the leaked data came from, and I could guess that it was being held by some reference, but

[Haskell-cafe] Re: type synonym liberalization (was class [] proposal)

2006-08-22 Thread Brandon Moore
Arie Peterson wrote: Hello Brandon, This could be handled with existential wrappers, except that the wrapping is annoying, and probably interferes with optimizing when a concrete type is known. Instead, a few changes to type synonyms handle Bulat's cases. With the proper interpretation,