[Haskell-cafe] Re: anybody can tell me the pronuncation of?haskell?

2008-01-30 Thread jerzy . karczmarczuk
Chung-chieh Shan corrects me: PS. If you think that arigato is a genuine Japanese word, well, check how the appropriately translated word is spelled in Portuguese... I'm not sure what you mean by genuine, but I suspect that whether arigato is genuine does not depend on Portuguese.

Re: [Haskell-cafe] Stacking monads - beginner design question

2008-01-30 Thread Johan Tibell
Are monad stacks with 3 and more monads common? How could an example implementation look like? I found reading the xmonad code (http://code.haskell.org/xmonad/) enlightening. The X monad definition can be found in http://code.haskell.org/xmonad/XMonad/Core.hs -- | The X monad, a StateT

Re: [Haskell-cafe] NDP

2008-01-30 Thread Stephan Friedrichs
Roman Leshchinskiy wrote: [...] Yes, me :-) Sorry for the late reply, it's been a long weekend here in Australia. Wow, Australia :) [...] I suspect that cd examples; make doesn't quite work at the moment because some of the examples are broken. I'll try to fix that soon. But cd

Re: [Haskell-cafe] Deleting list of elements from Data.Set

2008-01-30 Thread Duncan Coutts
On Wed, 2008-01-30 at 11:05 +, Gracjan Polak wrote: My strictness analyser in my brain hurts. Which one (foldl,foldl',foldr) is the best way? Prelude Data.Set Data.List let s = fromList [1,2,3,4,5] Loading package array-0.1.0.0 ... linking ... done. Loading package

[Haskell-cafe] Security Notice: Buffer overflow fixed in PCRE library

2008-01-30 Thread ChrisK
The PCRE library has just fixed a buffer overflow (related to UTF-8 mode). There are several haskell wrappers for the pcre library. If you use a wrapper for the PCRE library (libpcre) then you may want to upgrade the underlying library. http://pcre.org/news.txt states: News about PCRE

[Haskell-cafe] Deleting list of elements from Data.Set

2008-01-30 Thread Gracjan Polak
My strictness analyser in my brain hurts. Which one (foldl,foldl',foldr) is the best way? Prelude Data.Set Data.List let s = fromList [1,2,3,4,5] Loading package array-0.1.0.0 ... linking ... done. Loading package containers-0.1.0.0 ... linking ... done. Prelude Data.Set Data.List foldl (.) id

Re: [Haskell-cafe] Deleting list of elements from Data.Set

2008-01-30 Thread Luke Palmer
On Jan 30, 2008 11:05 AM, Gracjan Polak [EMAIL PROTECTED] wrote: My strictness analyser in my brain hurts. Which one (foldl,foldl',foldr) is the best way? Prelude Data.Set Data.List let s = fromList [1,2,3,4,5] Loading package array-0.1.0.0 ... linking ... done. Loading package

Re: [Haskell-cafe] Simple network client

2008-01-30 Thread Timo B. Hübel
On Wednesday 30 January 2008 13:03:27 you wrote: Just don't use hGetContents in any serious code, or any program longer than 4 lines. What else do you suggest? I just want to read something out of the socket without knowing it's length beforehand (my example here used ordinary Strings, but

Re: [Haskell-cafe] Simple network client

2008-01-30 Thread Jules Bean
Your bug here is hGetContents. Don't use it. Lazy IO gremlins bite once again. Your client is waiting for the server to close the socket before it prints anything. But your server is waiting for the client to close the socket before *it* prints anything. Just don't use hGetContents in any

Re: [Haskell-cafe] Simple network client

2008-01-30 Thread Reinier Lamers
Timo B. Hübel wrote: On Wednesday 30 January 2008 13:03:27 you wrote: Just don't use hGetContents in any serious code, or any program longer than 4 lines. What else do you suggest? I just want to read something out of the socket without knowing it's length beforehand (my example here

Re: [Haskell-cafe] Simple network client

2008-01-30 Thread Jules Bean
Timo B. Hübel wrote: On Wednesday 30 January 2008 13:32:42 you wrote: Timo B. Hübel wrote: On Wednesday 30 January 2008 13:03:27 you wrote: Just don't use hGetContents in any serious code, or any program longer than 4 lines. What else do you suggest? I just want to read something out of the

Re: [Haskell-cafe] Simple network client

2008-01-30 Thread Timo B. Hübel
On Wednesday 30 January 2008 13:32:42 you wrote: Timo B. Hübel wrote: On Wednesday 30 January 2008 13:03:27 you wrote: Just don't use hGetContents in any serious code, or any program longer than 4 lines. What else do you suggest? I just want to read something out of the socket without

[Haskell-cafe] Poor libraries documentation

2008-01-30 Thread Neil Mitchell
Hi, I went looking for the the function in Haskell to calculate cos^{-1}, inverse cosine. Unfortunately, the poor documentation in the libraries hampered my attempts. The documentation for the trig functions in Haskell is completely non-existent:

[Haskell-cafe] ffi and pass by value structs

2008-01-30 Thread Federico Squartini
Is there a way in the foreign function interface to pass to a function a struct by value? I explain it better. There are two ways in c to pass structs, as in the following example: /* begin c code */ struct couple{ int a; int b; }; //by value int print_couple (struct couple cpl) {

Re: [Haskell-cafe] Simple network client

2008-01-30 Thread Jules Bean
Timo B. Hübel wrote: On Wednesday 30 January 2008 13:51:58 you wrote: Okay, but then I have to make sure that my strings won't contain any newline characters, right? If this is the case, another question raises up: I am using Data.Binary to do the serialization of my data structures to

Re: [Haskell-cafe] Poor libraries documentation

2008-01-30 Thread Jules Bean
Neil Mitchell wrote: For a start, its probably a good idea to mention that cos is an abbreviation of cosine (most people will know, but its handy to state it). Secondly, and much more importantly, it should state whether these measurements are in degrees or radians. It should also state things

Re: [Haskell-cafe] Simple network client

2008-01-30 Thread Timo B. Hübel
On Wednesday 30 January 2008 14:09:31 you wrote: This sounds good, but don't I throw away all (possible) performance gains of transmitting ByteStrings directly when using show/read to convert them to ordinary strings and back? Probably not all of them, but some of them, definitely. If

Re: [Haskell-cafe] Poor libraries documentation

2008-01-30 Thread Henning Thielemann
On Wed, 30 Jan 2008, Jules Bean wrote: Neil Mitchell wrote: For a start, its probably a good idea to mention that cos is an abbreviation of cosine (most people will know, but its handy to state it). Secondly, and much more importantly, it should state whether these measurements are in

Re: [Haskell-cafe] Poor libraries documentation

2008-01-30 Thread Johan Tibell
I imagine the laziness here was because these all match their names in the traditional libc, accessable via manpages. You may not consider that an excuse :) I don't! To do something about it I'll adopt Network.Socket and document that (I did the same with some other base module half a year

Re: [Haskell-cafe] Poor libraries documentation

2008-01-30 Thread Henning Thielemann
On Wed, 30 Jan 2008, Robin Green wrote: On Wed, 30 Jan 2008 13:15:41 + Jules Bean [EMAIL PROTECTED] wrote: Neil Mitchell wrote: For a start, its probably a good idea to mention that cos is an abbreviation of cosine (most people will know, but its handy to state it). Secondly,

[Haskell-cafe] Re: Deleting list of elements from Data.Set

2008-01-30 Thread Gracjan Polak
Duncan Coutts duncan.coutts at worc.ox.ac.uk writes: Data.List.foldr (Data.Set.delete) s [1,3,5] or Data.List.foldl' (flip Data.Set.delete) s [1,3,5] There will be a day when I finally grasp foldr/foldl :) which is O (n + m * log m) rather than O(m * log n) or if the elements you're

RE: [Haskell-cafe] Simple network client

2008-01-30 Thread Peter Verswyvelen
Yes, and if I'm correct this hGetContents is used by many other functions, such as readFile... As a newbie I made a nice little program that called readFile and writeFile on the same filename, but of course the file handle of the readFile was not closed yet = access denied. A nice case of

Re: [Haskell-cafe] Poor libraries documentation

2008-01-30 Thread Robin Green
On Wed, 30 Jan 2008 13:15:41 + Jules Bean [EMAIL PROTECTED] wrote: Neil Mitchell wrote: For a start, its probably a good idea to mention that cos is an abbreviation of cosine (most people will know, but its handy to state it). Secondly, and much more importantly, it should state

[Haskell-cafe] Re: Deleting list of elements from Data.Set

2008-01-30 Thread apfelmus
Gracjan Polak wrote: Data.List.foldr (Data.Set.delete) s [1,3,5] or Data.List.foldl' (flip Data.Set.delete) s [1,3,5] There will be a day when I finally grasp foldr/foldl :) Maybe http://en.wikibooks.org/wiki/Haskell/Performance_Introduction

Re: [Haskell-cafe] NDP

2008-01-30 Thread Roman Leshchinskiy
Stephan Friedrichs wrote: dotp.hs:13:0: Bad interface file: ../lib/Bench/Benchmark.hi mismatched interface file versions: expected 60920080126, found 60920080124 make: *** [dotp.o] Fehler 1 You should make clean in ndp/examples. Sorry this doesn't happen automatically, the

Re: [Haskell-cafe] Stacking monads - beginner design question

2008-01-30 Thread Brent Yorgey
On Jan 30, 2008 12:44 AM, Adam Smyczek [EMAIL PROTECTED] wrote: Hi, My application has to manage a data set. I assume the state monad is designed for this. The state changes in functions that: a. perform IO actions and b. return execution status and execution trace (right now I'm using

RE: [Haskell-cafe] Simple network client

2008-01-30 Thread Bayley, Alistair
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Peter Verswyvelen As a newbie I made a nice little program that called readFile and writeFile on the same filename, but of course the file handle of the readFile was not closed yet = access denied. A nice case of getting

Re: [Haskell-cafe] NDP

2008-01-30 Thread Stephan Friedrichs
Roman Leshchinskiy wrote: [...] You should make clean in ndp/examples. Sorry this doesn't happen automatically, the whole setup is a bit of a mess at the moment. Now it works, thanks a lot :) Sorry for the German make output, but I'm no admin on this machine No worries, I actually

Re: [Haskell-cafe] Poor libraries documentation

2008-01-30 Thread Bryan O'Sullivan
Neil Mitchell wrote: For a start, its probably a good idea to mention that cos is an abbreviation of cosine (most people will know, but its handy to state it). Secondly, and much more importantly, it should state whether these measurements are in degrees or radians. It should also state

Re: [Haskell-cafe] Simple network client

2008-01-30 Thread Bryan O'Sullivan
Peter Verswyvelen wrote: Then I tried the seq hack to force the handle opened by readFile to be closed, but that did not seem to work either. For example, the following still gave access denied: main = do cs - readFile L:/Foo.txt writeFile L:/Foo.txt $ seq (length cs) cs This is

Re: [Haskell-cafe] Simple network client

2008-01-30 Thread Adam Langley
On Jan 30, 2008 4:32 AM, Jules Bean [EMAIL PROTECTED] wrote: The third, but more sophisticated answer is to use non-blocking IO, read 'only what is available', decide if it's enough to process, if not store it in some local buffer until next time. This is much more work and easy to implement

Re: [Haskell-cafe] ffi and pass by value structs

2008-01-30 Thread Adam Langley
On Jan 30, 2008 5:16 AM, Federico Squartini [EMAIL PROTECTED] wrote: foreign import ccall print_couple_ptr printCouple::Ptr Couple-IO Int But not the first, as a struct it's not an atomic type. So how does one solve this issue? (This applies to x86-64 only!) In the case of your struct

Re: [Haskell-cafe] Simple network client

2008-01-30 Thread Judah Jacobson
On Jan 30, 2008 8:31 AM, Bryan O'Sullivan [EMAIL PROTECTED] wrote: Peter Verswyvelen wrote: Then I tried the seq hack to force the handle opened by readFile to be closed, but that did not seem to work either. For example, the following still gave access denied: main = do cs -

Re: [Haskell-cafe] Simple network client

2008-01-30 Thread Jules Bean
Judah Jacobson wrote: On Jan 30, 2008 8:31 AM, Bryan O'Sullivan [EMAIL PROTECTED] wrote: Peter Verswyvelen wrote: Then I tried the seq hack to force the handle opened by readFile to be closed, but that did not seem to work either. For example, the following still gave access denied: main =

[Haskell-cafe] Improving 'project'

2008-01-30 Thread Justin Bailey
All, project doesn't easily let me add a few columns to an existing query (or take a few columns away). Instead, each use of project requires me to build the entire list of columns I'd like to pass on by hand. Before I go further, if there is a way to do that, please let me know. An example of

Re: [Haskell-cafe] Re: anybody can tell me the pronuncation of?haskell?

2008-01-30 Thread Dan Weston
The opposite can also happen. Tobacco (mid-16th century Spanish) is rendered as tabako in Japanese, in fact a very Japanese-sounding word (perhaps from, ta + hako). This may explain why, unlike almost all foreign words in Japanese that are written in katakana (a sort of simpler-looking

Re: [Haskell-cafe] Simple network client

2008-01-30 Thread Gary Bickford
One rather funky but effective solution might be to use the tftp protocol. No security, but simple, flexible and efficient. I think there are C libraries that implement it. This would take care of handshaking binary data. I have no idea if anyone has ever used it in Haskell. GB On Wed,

[Haskell-cafe] Re: [Haskell] Why functional programming matters

2008-01-30 Thread Stephan Friedrichs
Don Stewart wrote: stephan.friedrichs: [...] We [1] implemented an ad-hoc chat system in Haskell in the SEP [2] at the TU-Braunschweig. Wow! Looks like lots of great code in there, http://sep07.mroot.net/documentation/barracuda/ Text.ParserCombinators.Parsec.XML

[Haskell-cafe] Fwd: Improving 'project'

2008-01-30 Thread Justin Bailey
My apologies for the cryptic email below - I meant it for the haskell-db users list. And now I have to apologize for this spam too. Should I send yet another email? ;) Justin -- Forwarded message -- From: Justin Bailey [EMAIL PROTECTED] Date: Jan 30, 2008 10:00 AM Subject:

Re: [Haskell-cafe] Simple network client

2008-01-30 Thread Bryan O'Sullivan
Adam Langley wrote: Also, if you want the above approach (read a bit, see if it's enough), see IncrementalGet in the binary-strict package which is a Get with a continuation monad that stops when it runs out of bytes and returns a continuation that you can give more data to in the future.

Re: [Haskell-cafe] Simple network client

2008-01-30 Thread Adam Langley
On Jan 30, 2008 12:04 PM, Bryan O'Sullivan [EMAIL PROTECTED] wrote: Adam Langley wrote: I'd have expected it to look more like this: data Result a = Failed String | Finished B.ByteString a | Partial (B.ByteString - Result a) (The change here is from a list to a

Re: [Haskell-cafe] Simple network client

2008-01-30 Thread Bryan O'Sullivan
Adam Langley wrote: On Jan 30, 2008 1:07 PM, Adam Langley [EMAIL PROTECTED] wrote: So, if I don't hear otherwise soon, I'll probably push a new version of binary-strict later on today with the interface above. It's in the darcs now, http://darcs.imperialviolet.org/binary-strict Thanks!

RE: [Haskell-cafe] Simple network client

2008-01-30 Thread Peter Verswyvelen
And even better is main = do cs - strictReadFile L:/Foo.txt writeFile L:/Foo.txt cs Yes. By making these mistakes I understand the problem very well now. But it *is* hard to see if the function in question is strict or lazy. For example, the problem to me appears to be that this

Re: [Haskell-cafe] Simple network client

2008-01-30 Thread Adam Langley
On Jan 30, 2008 1:07 PM, Adam Langley [EMAIL PROTECTED] wrote: So, if I don't hear otherwise soon, I'll probably push a new version of binary-strict later on today with the interface above. It's in the darcs now, http://darcs.imperialviolet.org/binary-strict AGL -- Adam Langley

Re: [Haskell-cafe] Simple network client

2008-01-30 Thread Dan Weston
Peter Verswyvelen wrote: main = do cs - getLine putStrLn (Hello ++cs) looks so much like main = do cs - readFile foo writeFile foo cs but in the first one cs is strict, while the second it is lazy... But that's not obvious. Now I'm confused (which happens

Re: [Haskell-cafe] Simple network client

2008-01-30 Thread Jules Bean
Dan Weston wrote: Now I'm confused (which happens quite a lot, I'm afraid!) Prelude readFile undefined *** Exception: Prelude.undefined Prelude readFile undefined = \cs - putStrLn Hello *** Exception: Prelude.undefined It seems that readFile is strict in its argument. As for getLine, it has

Re: [Haskell-cafe] Simple network client

2008-01-30 Thread Evan Laforge
PS: I would love to see an immutable filesystem that does not allow writing to files, it only creates new files and garbage collects files that have no incoming reference anymore... Just like a garbage collected heap, and a bit like an OLAP databases (as far as I remember my DB theory...)

[Haskell-cafe] Relevance and applicability of category theory

2008-01-30 Thread aaltman
Category theory seems to have an inconsistent relationship to Haskell - both documentation and the language's implementations of categorical concepts. I come from a math background that makes the Haskell's tight coupling to its mathematical foundation very appealing. But, I may have

Re: [Haskell-cafe] Relevance and applicability of category theory

2008-01-30 Thread Miguel Mitrofanov
1. Are Haskell monads useful in a truly categorical sense? 2. Is Haskell's functor class misnamed? 3. Haskell arrows and Haskell monads have a misleading relationship I'm confused. It seems for me that either I don't understand math or I don't understand you. 1. Categorical monads are a

Re: [Haskell-cafe] Relevance and applicability of category theory

2008-01-30 Thread Derek Elkins
On Wed, 2008-01-30 at 16:23 -0800, [EMAIL PROTECTED] wrote: Category theory seems to have an inconsistent relationship to Haskell - both documentation and the language's implementations of categorical concepts. I come from a math background that makes the Haskell's tight coupling to its

Re: [Haskell-cafe] Relevance and applicability of category theory

2008-01-30 Thread Dan Weston
I assume you have read the references in http://www.haskell.org/haskellwiki/Research_papers/Monads_and_arrows The penultimate sentence in question 1 below (role of adjoint functors in Haskell monads) was addressed by David Menendez in a recent post to this list:

Re: [Haskell-cafe] Poor libraries documentation

2008-01-30 Thread Neil Mitchell
Hi Neil is on Windows. Windows doesn't have man pages (or libc). Standard C math library does always contain trigonometric functions - doesn't it? My libc (as installed by Visual Studio, and called msvscrt) comes with all these functions, but no manpages, and the MSDN (manpages for Windows)

Re: [Haskell-cafe] Poor libraries documentation

2008-01-30 Thread Derek Elkins
On Thu, 2008-01-31 at 02:18 +, Neil Mitchell wrote: Hi Neil is on Windows. Windows doesn't have man pages (or libc). Standard C math library does always contain trigonometric functions - doesn't it? My libc (as installed by Visual Studio, and called msvscrt) comes with all

Re: [Haskell-cafe] Relevance and applicability of category theory

2008-01-30 Thread Aaron Altman
David's post looks like it has cleared up what I was wondering about. I think it was the specific contents of Ob(Hask) and Haskell functions as arrows in Hask that I was unclear on. With that in mind I understand and agree with Miguel's explanations. Thanks, guys. Dan Weston wrote: I

Re: [Haskell-cafe] Poor libraries documentation

2008-01-30 Thread Isaac Dupree
Johan Tibell wrote: I imagine the laziness here was because these all match their names in the traditional libc, accessable via manpages. You may not consider that an excuse :) I don't! To do something about it I'll adopt Network.Socket and document that (I did the same with some other base

Re: [Haskell-cafe] Poor libraries documentation

2008-01-30 Thread Anton van Straaten
Derek Elkins wrote: On Thu, 2008-01-31 at 02:18 +, Neil Mitchell wrote: ... It isn't something that would throw a C programmer off, but it is something that could confuse a pure Haskell programmer. And the only way I could be sure of radians versus degrees was by trying it out, not a great

Re: [Haskell-cafe] Poor libraries documentation

2008-01-30 Thread Thomas DuBuisson
On Wed, 2008-01-30 at 19:32 -0600, Derek Elkins wrote: Uh, why not? Often that's exactly what I do as checking even conveniently located documentation is more time consuming than just trying it. I find it agreeable that there always be documentation for exported functions. In my undergrad

Re: [Haskell-cafe] Poor libraries documentation

2008-01-30 Thread Derek Elkins
On Wed, 2008-01-30 at 22:19 -0500, Anton van Straaten wrote: Derek Elkins wrote: On Thu, 2008-01-31 at 02:18 +, Neil Mitchell wrote: ... It isn't something that would throw a C programmer off, but it is something that could confuse a pure Haskell programmer. And the only way I could

Re: [Haskell-cafe] Poor libraries documentation

2008-01-30 Thread Jonathan Cast
On 30 Jan 2008, at 7:19 PM, Anton van Straaten wrote: Derek Elkins wrote: On Thu, 2008-01-31 at 02:18 +, Neil Mitchell wrote: ... It isn't something that would throw a C programmer off, but it is something that could confuse a pure Haskell programmer. And the only way I could be sure of

Re: [Haskell-cafe] trying to use unix's openFD ..

2008-01-30 Thread Brandon S. Allbery KF8NH
On Jan 30, 2008, at 23:05 , Galchin Vasili wrote: Hello, The signature for openFD is openFd: FilePath - OpenMode - Maybe FileMode - OpenFileFlags - IO Fd I am currently reading http://www.haskell.org/ghc/docs/latest/html/

Re: [Haskell-cafe] trying to use unix's openFD ..

2008-01-30 Thread Galchin Vasili
i.e. only the Linux CDROM device driver in read-only mode V. On Jan 30, 2008 11:23 PM, Galchin Vasili [EMAIL PROTECTED] wrote: I am trying to do the following on RedHat RHEL 5.0: main = do fs - openFd /dev/cdrom ReadOnly (Just ???) defaultFileFlags putStrLn (show fd) what

Re: [Haskell-cafe] trying to use unix's openFD ..

2008-01-30 Thread Brandon S. Allbery KF8NH
On Jan 30, 2008, at 23:23 , Galchin Vasili wrote: I am trying to do the following on RedHat RHEL 5.0: main = do fs - openFd /dev/cdrom ReadOnly (Just ???) defaultFileFlags putStrLn (show fd) what should (Just ???) be ??? I think you can pass Nothing instead of a Just, since that

Re: [Haskell-cafe] trying to use unix's openFD ..

2008-01-30 Thread Galchin Vasili
I am trying to do the following on RedHat RHEL 5.0: main = do fs - openFd /dev/cdrom ReadOnly (Just ???) defaultFileFlags putStrLn (show fd) what should (Just ???) be ??? Regards, Vasili On Jan 30, 2008 11:10 PM, Brandon S. Allbery KF8NH [EMAIL PROTECTED] wrote: On Jan 30, 2008, at

Re: [Haskell-cafe] trying to use unix's openFD ..

2008-01-30 Thread Galchin Vasili
MY bad!!! I was trying to open /dev/cdrom/ and not dev/cdrom!!! and hence /dev/cdrom/ was correctly treated as a directory ... Vasili On Jan 30, 2008 11:25 PM, Brandon S. Allbery KF8NH [EMAIL PROTECTED] wrote: On Jan 30, 2008, at 23:23 , Galchin Vasili wrote: I am trying to do the