Re: [Haskell-cafe] Collection of objects?

2006-11-17 Thread Donn Cave
for the types you want to support - data Object = IntObject Int | StringObject String objectString :: Object - String objectString (IntObject v) = show v objectString (StringObject v) = v main = mapM (putStrLn . objectString) [(IntObject 7), (StringObject eight)] Donn Cave, [EMAIL

Re: [Haskell-cafe] what GUI library should i select?

2006-11-13 Thread Donn Cave
is the same with the other, right? thanks, Donn Cave, [EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] non-blocking Socket

2006-11-13 Thread Donn Cave
in Haskell, so whatever problem with one is the same with the other, right? thanks, Donn Cave, [EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] ByteString FFI

2006-11-12 Thread Donn Cave
don't see any other Ptr-related function or constructor in the documentation - am I missing something there? Thanks, Donn Cave, [EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo

Re: [Haskell-cafe] ByteString FFI

2006-11-12 Thread Donn Cave
, and that didn't leak nearly as much memory - but still some, in a simple loop where pack doesn't leak anything. Thanks, Donn Cave, [EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo

Re: [Haskell-cafe] Trouble with simple embedding of shell in haskell

2006-09-21 Thread Donn Cave
hi shell process, because that process exits instead of reading from its input.) I can't say whether you really need forkIO, or whether it's really going to do what you need - not only do I not know enough about the thread model, neither do I know what you're really trying to do. Donn Cave

Re: [Haskell-cafe] Re: Trouble with simple embedding of shell in haskell

2006-09-21 Thread Donn Cave
. For me, it hangs - since I left the wait in. If I omit the wait, it's broken pipe, I think because we're trying to write data to head after it exits. Donn Cave, [EMAIL PROTECTED] sh :: String - String - IO String sh cmd = \input - do (stdin, stdout, _, pid

Re: [Haskell-cafe] getContents and lazy evaluation

2006-09-01 Thread Donn Cave
involve operations on the file handle, e.g., hClose. Donn Cave, [EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] getContents and lazy evaluation

2006-09-01 Thread Donn Cave
in such cases. For example, one common way to share a file is to interlock around some resource, and when you acquire the lock, you read the file (get its contents) and release the lock. Donn Cave, [EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell

Re: [Haskell-cafe] Why Not Haskell?

2006-08-04 Thread Donn Cave
their livelihood on Haskell software development - it isn't the safe choice, and it means someone finds the reasons for it very compelling. Donn Cave, [EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman

Re: [Haskell-cafe] Why Not Haskell?

2006-08-04 Thread Donn Cave
On Fri, 4 Aug 2006, Udo Stenzel wrote: Hans van Thiel wrote: I'm wondering why I can't find any commercial Haskell applications on the Internet. Is there any reason for this? Of course. Corporations are conservative to the point of being boneheaded. So to avoid risk, they all went on the

[Haskell-cafe] C++ virtual methods (was Reviving wxHaskell)

2006-08-03 Thread Donn Cave
seems obtuse, I haven't used wxHaskell, more interested in the idea in general - I've done it with Python, but there the API is more obvious.) Donn Cave, [EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org

Re: [Haskell-cafe] Monad Imparative Usage Example

2006-08-02 Thread Donn Cave
On Wed, 2 Aug 2006, Donald Bruce Stewart wrote: ... Of course, if you're learning Haskell, you should probably try to /avoid/ mutable variables for a while. Along the same line, I note that proposed solutions seem to use features relatively recently added to the language, is that true? StateT

[Haskell-cafe] Re: ldap-haskell questions (+ rant!)

2006-07-26 Thread Donn Cave
- I'm asking for the easy thing! You don't need to know why execve() needs to support argv[0..n]. You don't need to know why there's an ldap_bind_s, and an ldap_bind. Just give me access to the functions the way they are, please! Thanks! Donn Cave, [EMAIL PROTECTED

Re: [Haskell-cafe] Why does Haskell have the if-then-else syntax?

2006-07-26 Thread Donn Cave
be assigned to the else clause, but there don't tend to be that many other such contexts. Does that answer the question? Donn Cave, [EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo

[Haskell-cafe] Re: ldap-haskell questions

2006-07-16 Thread Donn Cave
, but something about LDAP_OPT_X_TLS hints that it may be non-standard. Donn Cave, [EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] ldap-haskell questions

2006-07-14 Thread Donn Cave
so on the link command, libldap.a instead of -lldap. Pardon me if that's obvious! Donn Cave, [EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Re: Why is there no splitBy in the list module?

2006-07-12 Thread Donn Cave
is type 1. UNIX shell does that, awk, Python ... (Perl is awk gone horribly wrong, so it presumably does but if it doesn't, it's the exception that proves the rule.) It has worked for a lot of people who do a lot of splitting, for a lot of years. Donn Cave, [EMAIL PROTECTED

Re: [Haskell-cafe] Re: Why is there no splitBy in the list module?

2006-07-12 Thread Donn Cave
the split condition be the first parameter -- the infix notation looks good, but it will need a flip to get the parameters in the right order. Donn Cave, [EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org

Re: [Haskell-cafe] Re: Why is there no splitBy in the list module?

2006-07-12 Thread Donn Cave
(xs) | == | \n `join` xs |in Haskell (wherejoin sep = concat . intersperse sep ) Suit yourself! Since we seem to be in agreement on the basic point, I won't go into what I think about \n.join(xs). Donn Cave, [EMAIL PROTECTED

Re: [Haskell-cafe] Re: Why is there no splitBy in the list module?

2006-07-11 Thread Donn Cave
simply compare with a separator string, but could easily do more - eat up trailing blanks, for example. Note use of Maybe, basically to disambiguate end of data with and without match. Donn Cave, [EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell

Re: [Haskell-cafe] type dependency

2006-07-10 Thread Donn Cave
-parameter typeclass. Donn Cave, [EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Re: develop new Haskell shell?

2006-05-12 Thread Donn Cave
Haskell into this application domain is an absurdity on the order of Edgar Rice Burroughs' fantasy of Tarzan appearing out of the jungle and being appointed chief of the Waziri. Donn Cave, [EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe

Re: [Haskell-cafe] Re: develop new Haskell shell?

2006-05-12 Thread Donn Cave
, and there would need to be some rules about how binaries would work to cooperate with the Haskell type system. What about the parameters - certainly there's little point in relieving me of the bother of quoting a command name, if I have to quote each parameter? Donn Cave, [EMAIL PROTECTED

Re: [Haskell-cafe] develop new Haskell shell?

2006-05-11 Thread Donn Cave
Donn Cave, [EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] develop new Haskell shell?

2006-05-11 Thread Donn Cave
, but you know cat is actually a standard UNIX command, that writes to standard output and has no output file parameter? What's up with the new parameter in your version - was it not going to be workable the way it was? Donn Cave, [EMAIL PROTECTED

Re: [Haskell-cafe] trying to understand runProcess handles

2006-03-03 Thread Donn Cave
instead, for example. I don't see anything about what you were doing that would be obviously different from runProcessInteractive, but as long as you're making a pipe for error output, you may as well read it and see if gnuplot has left any clue to its problem there. Donn Cave, [EMAIL

Re: [Haskell-cafe] trying to understand runProcess handles

2006-03-03 Thread Donn Cave
descriptor may be inherited by multiple processes, any one of which may hold it open - only the last close matters. That's why functions like runProcess normally close the opposite ends of the pipe, in the parent child forks, so that the parent doesn't hold the child's open or vice versa. Donn

Re: [Haskell-cafe] Picking a shell for runCommand

2006-02-28 Thread Donn Cave
= runProcess /bin/tcsh [-c, cmd] Nothing Nothing Nothing Nothing Nothing The 2nd parameter is argv with argv[0] gratuitously removed. Donn Cave, [EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http

Re: [Haskell-cafe] Re: standard poll/select interface

2006-02-23 Thread Donn Cave
devices like a tty, pipe etc. Select/poll/epoll are designed to work primarily with non-blocking I/O. That's what the Linux kernel developers say, anyway, since it would be inconvenient for them to fix this, even though it apparently violates the POSIX specification. Donn Cave, [EMAIL

Re: [Haskell-cafe] Re: getChar + System.Cmd.system + threads causes hangups

2006-02-21 Thread Donn Cave
, can open or dup another file onto fd 0. Conversely, if a program contrives to change stdin to something besides fd 0, I would have assumed the intent was to avoid any affect on child processes. Donn Cave, [EMAIL PROTECTED] ___ Haskell-Cafe

Re: [Haskell-cafe] Re: standard poll/select interface

2006-02-21 Thread Donn Cave
filesystem events along with the usual select stuff. Donn Cave, [EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Infinite loop?

2006-02-19 Thread Donn Cave
this function, but it looks promising. Donn Cave, [EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re[3]: [Haskell-cafe] Emulating bash pipe/ process lib

2006-02-10 Thread Donn Cave
/O, and that the need for this can occur in such ordinary, mundane applications as reading stdout and stderr in parallel. Donn Cave, [EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo

Re: [Haskell-cafe] FFI question

2006-02-09 Thread Donn Cave
is that this parrot is dead, and everyone is just too polite to say so. Unfortunately, this inability to pull the shades on Green Card, Haskell Direct, etc., takes away a little from ghc's outstanding FFI. Donn Cave, [EMAIL PROTECTED] ___ Haskell

Re[2]: [Haskell-cafe] Emulating bash pipe/ process lib

2006-02-09 Thread Donn Cave
work on top of the file descriptor, but what makes it worth the trouble? Donn Cave, [EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] How to redirect a handle within a thread (GHC 6.4.1 runtime)?

2006-01-18 Thread Donn Cave
the flushes in my example. The first may be necessary to avoid copying buffered data into the fork, which would cause it to appear twice. The second is a work-around for a bug that was mentioned here only a day or two ago. Donn Cave, [EMAIL PROTECTED] module Main (main) where import

Re: [Haskell-cafe] hPutStrLn and hFlush

2006-01-09 Thread Donn Cave
or close is needed only in relatively rare circumstances. C, for example ... in fact, I'm surprised to see this behavior in any I/O library. The point of difference I expect, in more modern languages, is between immediate and deferred finalization. Donn Cave, [EMAIL PROTECTED

Re: [Haskell-cafe] How to print a string (lazily)

2006-01-03 Thread Donn Cave
like that. So it isn't at all necessary to have another word for functions of type IO a. Donn Cave, [EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Proper way to write this

2005-12-26 Thread Donn Cave
Quoth Pupeno [EMAIL PROTECTED]: | On Monday 26 December 2005 02:41, Donn Cave wrote: | I don't think it will be too much worse. I would not try to | combine the struct updates, in the both case -- it doesn't buy | you anything, and pulls you into duplication you don't want. | What about

Re: [Haskell-cafe] Re: Tutorial uploaded

2005-12-22 Thread Donn Cave
there be a temptation to switch to the Objective CAML tutorial because of a mistaken impression. Donn Cave, [EMAIL PROTECTED] --- sequence :: Monad m = [m a] - m [a] sequence [] = return [] sequence (c:cs) = do x - c xs - sequence cs return (x:xs

Re: [Haskell-cafe] Re: Tutorial uploaded

2005-12-21 Thread Donn Cave
evidently didn't write any compiler in Haskell at all. Better a C++ program than a Haskell program that offends you? Donn Cave, [EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell

Re: [Haskell-cafe] Re: First steps in Haskell

2005-12-20 Thread Donn Cave
world in the scheme of things, or if at that first step it would be better to focus on the language. Donn Cave, [EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Opening the same file multiple times

2005-12-12 Thread Donn Cave
of this notion altogether. Donn Cave, [EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] syscall, sigpause and EINTR on Mac OSX

2005-12-11 Thread Donn Cave
when it occurs in library functions. Now if you actually have observed that your SIGINT handler was entered at this point, then please ignore me. Donn Cave, [EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http

Re: [Haskell-cafe] [Newbie] Why or why not haskell ?

2005-12-11 Thread Donn Cave
it depends a lot on when we decide we `have to' use FFI, and in the end the advantages will very often be too compelling. Even for basic data manipulation without Haskell overhead, like FPS. Donn Cave, [EMAIL PROTECTED] ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] Opening the same file multiple times

2005-12-11 Thread Donn Cave
hPutStr af append this line\n hSeek sf AbsoluteSeek 40 hGetLine sf = print hPutStr af append this line\n hSeek sf AbsoluteSeek 60 hGetLine sf = print (It works for me, with hugs on a more or less UNIX-like platform.) Donn Cave, [EMAIL

Re: [Haskell-cafe] Opening the same file multiple times

2005-12-11 Thread Donn Cave
Quoth Einar Karttunen ekarttun@cs.helsinki.fi: | On 11.12 22:26, Donn Cave wrote: | Quoth Einar Karttunen ekarttun@cs.helsinki.fi: | | It seems that opening the same file multiple times (one writer | | and multiple readers) is not supported at least on *nix with | | GHC. I want to use one

Re: [Haskell-cafe] Learning Haskell

2005-12-06 Thread Donn Cave
' is coming along. (Hope they figured out a better | name, anyway.) | | Got an url for the project? http://homepages.inf.ed.ac.uk/wadler/links/ Having looked it up, of course I looked at it. Please forget I asked. Donn Cave, [EMAIL PROTECTED

Re: [Haskell-cafe] Learning Haskell

2005-12-05 Thread Donn Cave
Quoth Jimmie Houchin [EMAIL PROTECTED]: ... | Haskell looks like a very interesting language. I am only so-so with | Python and I thought that maybe if instead of spending sufficient time | to get proficient with Python, I could invest a similar time (more or | less) and get reasonably

Re: [Haskell-cafe] first post

2005-11-30 Thread Donn Cave
style of writing, does ... end a sentence, or should that be interpreted in some other way? Donn Cave, [EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Endian conversion

2005-10-06 Thread Donn Cave
32 bit floats on the C side before swapping them with htonl. Donn Cave, [EMAIL PROTECTED] --- Netword.hsc --- -# OPTIONS -fffi #-} module Netword (htonl,ntohl) where import Foreign import Foreign.C #include netw.h foreign import ccall unsafe c_htonl htonl :: CInt - CInt foreign import

Re: [Haskell-cafe] case of (was: [Haskell] Mixing monadic and non-monadic functions)

2005-09-20 Thread Donn Cave
On Tue, 20 Sep 2005, Bernard Pope wrote: On Tue, 2005-09-20 at 10:14 +0200, Sven Moritz Hallberg wrote: Donn Cave schrieb: ... but how do you write getArgs = \ [] - putStrLn (no arguments) (a:_) - putStrLn (show a) What about good old let? main = getArgs

Re: [Haskell-cafe] case of (was: [Haskell] Mixing monadic and non-monadic functions)

2005-09-19 Thread Donn Cave
., this seems to be OK: getArgs = \ (a:_) - putStrLn (show a) but how do you write getArgs = \ [] - putStrLn (no arguments) (a:_) - putStrLn (show a) (pardon me if I missed where you were going in case of ...) Donn Cave, [EMAIL PROTECTED

Re: [Haskell-cafe] Suggestions for #defines with FFI

2005-07-27 Thread Donn Cave
fromLDAPOpt LDAP_OPT_X_TLS = (#const LDAP_OPT_X_TLS) fromLDAPOpt LDAP_OPT_X_TLS_REQUIRE_CERT = (#const LDAP_OPT_X_TLS_REQUIRE_CERT) fromLDAPOpt LDAP_OPT_PROTOCOL_VERSION = (#const LDAP_OPT_PROTOCOL_VERSION) fromLDAPOpt LDAP_OPT_DEBUG_LEVEL = (#const LDAP_OPT_DEBUG_LEVEL) etc. Donn

[Haskell-cafe] Re: How to variables/O'Haskell

2005-07-19 Thread Donn Cave
/survey.html, there are also some significant omissions. For example, he doesn't use this phrase, but I think there's no open recursion. I can't imagine using this language's OO features in a C++ toolkit wrapper. But I never tried it, and it might be an interesting demonstration project. Donn

Re: [Haskell-cafe] Fork execve

2005-07-05 Thread Donn Cave
version, than to check the shell command input data for shell punctuation that would have unintended results. If you're on another platform or using another Haskell implementation, it still might be worth a try, I just haven't tried it myself. Donn Cave, [EMAIL PROTECTED

Re: [Haskell-cafe] Space questions about intern and sets

2005-06-03 Thread Donn Cave
common mistake of discounting a trailing separator, so both A:A: and A:A split to [A, A], where the former should be [A, A, ]. It does handle :A:A and A::A correctly, so you can just wrap splitPS with a function that may add a nilPS depending on the end of the input string. Donn Cave

Re: [Haskell-cafe] Text search

2005-05-17 Thread Donn Cave
for curiosity's sake, how much string data are we talking about here? Is it practical to process a serious volume of data as [Char]? Donn Cave, [EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman

Re: [Haskell-cafe] Python?

2005-05-11 Thread Donn Cave
On Wed, 11 May 2005, Jerzy Karczmarczuk wrote: Pierre Barbier de Reuille wrote about Python and lambdas: Well, I would not recommand using lambda functions ! The main reason is they are limited in that they only accept expressions (ie. not statements) and you can end up with very ugly things

Re: [Haskell-cafe] Re: Haskell vs OCaml

2005-05-03 Thread Donn Cave
of Objective CAML (the language) as ocaml (the implementation), but given the choice of a language I can actually use on a given platform, I am predisposed to have a soft spot for its other virtues like predictable execution and a relatively rigorous OOP model when you want it. Donn Cave

Re: [Haskell-cafe] How to debug GHC

2005-04-26 Thread Donn Cave
need to also identify head's caller, then it should be obvious that this requirement is recursive. Donn Cave, [EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

<    1   2   3   4