Re: [Haskell-cafe] Errors in non-monadic code

2013-08-19 Thread Donn Cave
jabolo...@google.com, MIME-Version: 1.0 Content-type: text/plain; charset=UTF-8 In-Reply-To: References: quoth Brandon Allbery, > Even in IO, exceptions should be reserved for truly exceptional conditions > (of the "program cannot safely continue" variety), not merely for error > checking when

Re: [Haskell-cafe] Alternative name for return

2013-08-07 Thread Donn Cave
quoth Richard A. O'Keefe > Check the OED. Most of its meaning are about _turning back_, > _resuming_, _reverting_. Yielding or making a profit is not at > all about "providing a value", but about money going out AND > COMING BACK. It's the coming back part that makes it a "return". Yes. Retur

Re: [Haskell-cafe] Alternative name for return

2013-08-07 Thread Donn Cave
quoth Richard A. O'Keefe, ... > If you're familiar with *English* rather than, say, the C family of > programming languages, "return" isn't _that_ bad, there is certainly > nothing about the word that suggests providing a value. The RFC822 headers of your email suggest that you use a Macintosh com

Re: [Haskell-cafe] Proposal: Non-recursive let

2013-07-23 Thread Donn Cave
quoth David Thomas , > It strikes me as unlikely static analysis would be confused by shadowing. Not to mention that the example only created two expressions of type IO Fd? (I.e., no file descriptors were opened, let alone leaked.) But in any case, I would have guessed that the idea here is that

Re: [Haskell-cafe] Non-recursive let [Was: GHC bug? Let with guardsloops]

2013-07-10 Thread Donn Cave
quoth Andreas Abel , ... > I would doubt that nhc98 would interpret let xs = 0 : xs differently > than ghc if it implemented anything close to the Haskell 98 standard. What I (so vaguely) remember was a compile error, for some reuse of an identifier where GHC permitted it. I suppose you're ri

Re: [Haskell-cafe] Non-recursive let [Was: GHC bug? Let with guardsloops]

2013-07-10 Thread Donn Cave
quoth Alberto G. Corona, > Let is "recursive" because, unlike in the case of other > languages, variables are not locations for storing values, but the > expressions on the right side of the equality themselves. And obviously it > is not possible for a variable-expression to be two expressions at

Re: [Haskell-cafe] createProcess interferes with sockets?

2013-04-22 Thread Donn Cave
quoth Evan Laforge , ... > and it still waits for the subprocess to complete. Actually, it looks > like it's the client's hGetContents, since hGetChar comes back > immediately. I guess that's understandable, but even hGetLine blocks. In the version I was looking at, if I change the server's outp

Re: [Haskell-cafe] createProcess interferes with sockets?

2013-04-22 Thread Donn Cave
quoth Evan Laforge , ... > Oh I see, because the subprocess inherits the socket connection. That > makes sense, though it's tricky. Tricky tricky unix. Why does fork() > have to be so complicated? Well, it's very elegant really. It's one of the tools UNIX gives you to decompose a task into dis

Re: [Haskell-cafe] createProcess interferes with sockets?

2013-04-21 Thread Donn Cave
Quoth Evan Laforge , > sleep = Process.createProcess (Process.proc "sleep" ["5"]) sleep = Process.createProcess ((Process.proc "sleep" ["5"]) {Process.close_fds = True}) - Because the client uses buffered I/O (hGetContents in this case, but hGet-anything would be the same), it doesn't

Re: [Haskell-cafe] Overloading

2013-03-12 Thread Donn Cave
On Mar 13, 2013, at 12:54 AM, "Richard A. O'Keefe" wrote: > The interesting challenge here is that we should have > >Date + Period -> Date Date - Period -> Date >Period + Date -> Date Period - Date -> ILLEGAL >Period + Period -> DeriodPeriod - Period -> Period >

Re: [Haskell-cafe] Overloading

2013-03-10 Thread Donn Cave
Peter Caspers , >> data Month = January | ... > > ok, I will try to change my code in that direction. The idea is clear. To whatever extent these "algebraic" data types do map to integer values for your purposes, you can implement that by making Month an instance of Enum. Donn

Re: [Haskell-cafe] How to return a network connection to C

2013-02-28 Thread Donn Cave
Quoth C K Kashyap , > Hey Donn ... when you say, implement the IO in C, you also imply > implementing the SSL stuff too right? Yes, if you need encrypted I/O from C. Donn ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskel

Re: [Haskell-cafe] How to return a network connection to C

2013-02-28 Thread Donn Cave
Quoth C K Kashyap , > I am using http://hackage.haskell.org/package/connection. > So I create network connection in Haskell > > getConnection :: IO Connection > > I'd like this connection to be returned to C so that subsequent calls from > C can send in the connection handle. According to the doc

Re: [Haskell-cafe] Question about forkIO

2013-02-28 Thread Donn Cave
Quoth C K Kashyap , ... > Say I have a haskell function 'f' that does a forkIO and starts an action > "a". I create a DLL of this haskell code and inovke "f" from C. Can I > expect the "a" to continue to run once "f" has returned to C? Once control returns to f's caller, outside of the Haskell ru

Re: [Haskell-cafe] What is a Haskell way to implement flags?

2013-02-19 Thread Donn Cave
Quoth Branimir Maksimovic , > In C usual way is to set some bit in integer variable by shifting or oring, > and than check flag integer variable by anding with particular flag value. > What is Haskell way? Of course you may do the very same thing, if you like. I think if there's only one of thes

Re: [Haskell-cafe] FunPtr to C function with #arguments determined atruntime?

2013-02-17 Thread Donn Cave
Quoth Ryan Newton , ... > Anyway, in this case it wasn't *too *painful to just generate a bunch of > extra boilerplate C functions for (1) creating a data structure to hold the > arguments, (2) loading them in one at a time, and (3) deallocating the > structure when the call is done. Yuck. But no

Re: [Haskell-cafe] FunPtr to C function with #arguments determined atruntime?

2013-02-17 Thread Donn Cave
Quoth Ryan Newton , > The scenario is pretty simple. I generate C code at runtime. I compile it > to a .so. I know how many arguments it expects (but only at runtime), and > I get a FunPtr back from 'dlsym'. How do I call it? > > I was hoping there would be some "Raw" lower level FFI layer th

Re: [Haskell-cafe] ifdef based on which OS you're on

2013-02-16 Thread Donn Cave
As counterpoint to Vincent Hanquez' note about the certificate store on MacOS & Windows, I'd like to cast some doubt on the notion that you can reliably find the cert store here on Linux or the *BSDs. So, if my experience with platforms like that is any guide, you'd rather not "hard code" this val

Re: [Haskell-cafe] FFI - Approaches to C/C++

2013-01-31 Thread Donn Cave
Quoth Casey Basichis , ... > I am using several other C++ libraries for which there are no existing > bindings and no Haskell alternative packages that are even remotely > close. > > Are you suggesting it would be better to write all my own FFI bindings > for all the needed libraries? > > Everyth

Re: [Haskell-cafe] How can I avoid buffered reads?

2012-12-06 Thread Donn Cave
Quoth Brandon Allbery , > On Thu, Dec 6, 2012 at 3:24 PM, Tristan Seligmann > wrote: >>> On 29 Nov 2012 12:27 PM, "Leon Smith" wrote: >>> System.Posix.IO and Foreign.This appears to work, but for better or >>> worse, it is using blocking calls to the "read" system call and is not >>> integr

Re: [Haskell-cafe] Blocking IO & FIFOs

2012-10-21 Thread Donn Cave
>From Jason Dusek , ... > If I could somehow arrange to detect EOF when /tmp/exitpipe is > closed, then I might as well redirect 1 and 2 to FIFOs and wait > for them to EOF, collecting the output. > > However, all of my experiments suggest that there is simply no > way in Haskell to detect the clo

Re: [Haskell-cafe] Blocking IO & FIFOs

2012-10-20 Thread Donn Cave
Quoth Jason Dusek , ... > For my application, it's important to be able to run multiple > queries against the same Bash session. Waiting for Bash to shut > down is thus not a viable way to finalize the response. You could redirect to disk files and also use a pipe to wait for exit. I suppose you

Re: [Haskell-cafe] Getting PID of a child process

2012-10-18 Thread Donn Cave
Quoth Jason Dusek , > Using `System.Process.runInteractiveProcess', I can start a process > and get a handle to it: > > runInteractiveProcess >:: FilePath >-> [String] >-> Maybe FilePath >-> Maybe [(String, String)] >-> IO (Handle, Handle, Handle, ProcessHandle) > > For dia

Re: [Haskell-cafe] Issue building ghc on NetBSD/amd64

2012-10-16 Thread Donn Cave
Quoth lhagan , > Just tried changing the flag in build.mk, but I get the same error. Also, > I'm pretty sure I need the --enable-hc-boot flag. Without it, I > get: configure: error: GHC is required unless bootstrapping from .hc files. Unless I've missed a whole lot of progress on this matter, it'

Re: [Haskell-cafe] forkProcess, forkIO, and multithreaded runtime

2012-10-16 Thread Donn Cave
Since we're talking about forkIO here - not forkOS - is it possible to control the use of OS threads to avoid this problem? As I understand it, the problem is with real OS threads. A program running entirely in multiple `green' threads will fork to the same set of threads in the same state, creat

Re: [Haskell-cafe] createProcess running non-existent programs

2012-08-14 Thread Donn Cave
Quoth Alexander Kjeldaas , > See access(2) ... a classic "code smell" in UNIX programming, for the same reasons. We can solve this problem in an efficient way that works well, and equally well, on any POSIX platform that supports F_CLOEXEC on pipes, and I can't think of anything that doesn't. T

Re: [Haskell-cafe] createProcess running non-existent programs

2012-08-13 Thread Donn Cave
Quoth Brandon Allbery , > On Mon, Aug 13, 2012 at 10:23 AM, Donn Cave wrote: > >> Though speaking of platforms, I guess one large headache would be >> what to do about Microsoft operating systems. Given the unusual >> > > Microsoft provides APIs that work as is

Re: [Haskell-cafe] createProcess running non-existent programs

2012-08-13 Thread Donn Cave
Quoth Evan Laforge , ... > ... or at least make sure the haskell version doesn't suffer from > problems fixed in the python one. Exactly. This morning I'm reading suggested solutions that would work only some of the time, or on only some platforms, which wouldn't be satisfactory in the long run.

Re: [Haskell-cafe] do vs. pattern matching

2012-08-04 Thread Donn Cave
On Sat, Aug 4, 2012 at 7:05 AM, Alexander Solla wrote: > On Fri, Aug 3, 2012 at 11:34 PM, Matthew wrote: ... >> With do notation, I can write something like this: >> >> do >> foo <- callFoo x >> bar <- callBar x >> return (baz) >> ... > The short answer is to

Re: [Haskell-cafe] Martin Odersky on "What's wrong with Monads"

2012-06-28 Thread Donn Cave
To be fair, while it's great that Functor et al. are available to help solve problems like that with a Tree data structure, in the present context it mostly shows that a trivial example was used to illustrate the problem. Unless I'm missing how this generic fold functionality solves the more gener

Re: [Haskell-cafe] Haskell integration with C/C++ (GSOC)

2012-04-05 Thread Donn Cave
Quoth Anthony Cowley , ... > I think this is a consequence of line buffering rather than a bug. If > you write your own increment function in Haskell, you get the same > behavior. If you `hSetBuffering stdout NoBuffering` before your `putStr` > call, you should get the behavior you wanted. Though

Re: [Haskell-cafe] thread killed

2012-04-03 Thread Donn Cave
On Wed, Apr 4, 2012 at 6:37 AM, tsuraan wrote: > What sorts of things can cause a thread to get an asynchronous "thread > killed" exception? I've been seeing rare, inexplicable "thread > killed" messages in my Snap handlers for a long time, but they aren't > from Snap's timeout code. This is a

Re: [Haskell-cafe] Theoretical question: are side effects necessary?

2012-03-17 Thread Donn Cave
Quoth Chris Smith , ... > The answer is that side effects has become something of a figure of > speech, and now has a specialized meaning in programming languages. > > When we're talking about different uses of the word "function" in > programming languages, side effects refer to any effect other t

Re: [Haskell-cafe] Theoretical question: are side effects necessary?

2012-03-17 Thread Donn Cave
Quoth Jeff Shaw , ... > I'm thinking that side effects are really only necessary because Haskell > programs expect to mutate the state of a computer outside of the haskell > program. I'm not a computer scientist, but in English, "side effect" is an effect that accompanies some other effect. E.g

Re: [Haskell-cafe] Theoretical question: are side effects necessary?

2012-03-16 Thread Donn Cave
Quoth KC , > On Fri, Mar 16, 2012 at 7:44 PM, Jerzy Karczmarczuk > wrote: > >> ... but the question of purity of a program - in my opinion - concerns >> the program, and nothing else. > > You might be thinking of software engineering purity. Or software engineers might be thinking of purity in

Re: [Haskell-cafe] Preventing leaked open file descriptors whencatching exceptions

2012-02-21 Thread Donn Cave
Quoth "Bryan O'Sullivan" , > On Tue, Feb 21, 2012 at 8:16 AM, Ryan Newton wrote: > >> FYI, lsof confirms that there are indeed many many open connections to the >> same FIFO: >> > > Like all of the lowest-level I/O functions, openFD just gives you back an > integer, and the Fd type has no notion t

Re: [Haskell-cafe] Stable pointers: use of cast to/from Ptr

2012-02-13 Thread Donn Cave
Quoth =?ISO-8859-1?Q?Yves_Par=E8s?= , > You mean I have to use a type like StablePtr (IORef Stuff)? > Because there I can only "peek" (deRefStablePtr) the pointer, not "poke" it. > > I take it I should return to C a StablePtr to the new value if I don't want > to use IORefs... Yes ... > Or else

Re: [Haskell-cafe] Stable pointers: use of cast to/from Ptr

2012-02-12 Thread Donn Cave
Quoth Yves Pares, ... > If StablePtrs cannot have their pointed value modified (either C or > Haskell-side), that mostly limits their interest, doesn't it? I'm not sure I follow what's happening in the two cases you mention, but in case it helps, I use StablePtr as a way to smuggle Haskell values

Re: [Haskell-cafe] Some thoughts on Type-Directed Name Resolution -record update

2012-02-09 Thread Donn Cave
Quoth AntC , > Donn Cave avvanta.com> writes: ... > The narrow issue we're trying to address is namespacing, and specifically name > clashes: two different records with the same named field. ... > Now in return for me answering that, please answer the questions in my earli

Re: [Haskell-cafe] Some thoughts on Type-Directed Name Resolution

2012-02-09 Thread Donn Cave
Quoth Evan Laforge , > On Thu, Feb 9, 2012 at 12:49 PM, Donn Cave wrote: ... >> For example, in a better world you could write stuff like >> >> modifyConfig :: (Config -> a) -> (a -> a) -> Config -> Config >> modifyConfig fr fv a = a { fr = fv (fr

Re: [Haskell-cafe] Some thoughts on Type-Directed Name Resolution -record update

2012-02-09 Thread Donn Cave
Quoth AntC , ... > No, Donn, it's not the lack of syntax, it's the lack of semantics for first- > class (polymorphic) record update. And there's very little that's obvious. Ah, you're right, I certainly shouldn't have used the word "syntax" there. But just to be clear on the point, I wonder if you

Re: [Haskell-cafe] Some thoughts on Type-Directed Name Resolution

2012-02-09 Thread Donn Cave
Quoth Evan Laforge , ... > The non-composing non-abstract updates are what bug me, and > make me scatter about tons of 'modifyThis' functions, both for > composability and to protect from field renames. So ... at the risk of stating the obvious, is it fair to say the root of this problem is at lea

Re: [Haskell-cafe] Some thoughts on Type-Directed Name Resolution

2012-02-06 Thread Donn Cave
Quoth AntC , ... > It was a surprise to me that dot without spaces around is still legal > syntax for function composition. It isn't even unusual. You can find stuff like "fromIntegral.ord" in packages downloaded to build cabal-install for example. It graphically appeals to the notion of a funct

Re: [Haskell-cafe] Some thoughts on Type-Directed Name Resolution

2012-02-03 Thread Donn Cave
Quoth AntC , ... > We're on the slippery slope! Where will it end? > > And now that I've found it, I so love: > > customer.lastName.tail.head.toUpper-- Yay! ... compared to present practice, with where dot is function composition only - (toUpper.head.tail.lastName) customer So two co

Re: [Haskell-cafe] Some thoughts on Type-Directed Name Resolution

2012-01-31 Thread Donn Cave
Quoth AntC , ... > My proposal is that field selection functions be just ordinary functions, and > dot notation be just function application(tight-binding). Then: > object.fieldfuncmethod ==> fieldfuncmethod object > (Subject to the tight binding for the dot.) > And one-sided dot applicati

Re: [Haskell-cafe] [Haskell Cafe] strict version of Haskell - doesit exist?

2012-01-30 Thread Donn Cave
Quoth "Richard O'Keefe" , ... > On the other hand, a designed-to-be-strict language-and-libraries > with close-to-Haskell *syntax* would be nice. I recently > described F# as combining the beauty of Caml with the functional > purity of C# -- both of course are like the snakes of Ireland. Ouch, th

Re: [Haskell-cafe] Exceeding OS limits for simultaneous socketconnections

2012-01-30 Thread Donn Cave
Quoth Marc Weber , ... > - replace getContents conn by something strict and close the handle > yourself? (not sure about this.) That's an easy one to try, right? Just force evaluation of the getContents return value, in getMsg. If lazy I/O is the culprit here, it wouldn't be the first time. B

Re: [Haskell-cafe] Some thoughts on Type-Directed Name Resolution

2012-01-30 Thread Donn Cave
Quoth Steve Horne , > On 30/01/2012 07:09, Donn Cave wrote: >> ((separate . crack . .smallEnd) egg).yolk >> (f egg).yolk where f = separate . crack . .smallEnd > > Scary - that ".smallEnd" worries me. It's like a field is being > referenced with some magica

Re: [Haskell-cafe] Some thoughts on Type-Directed Name Resolution

2012-01-29 Thread Donn Cave
On 28/01/2012 13:00, Paul R wrote: ... > All this dot syntax magic frankly frightens me. Haskell, as a pure > functionnal language, requires (and allows !) a programming style that > just does not mix well with object oriented practices. Stretching the > syntax to have the dot feel a-bit-but-not-re

Re: [Haskell-cafe] named pipe interface

2012-01-14 Thread Donn Cave
Quoth "Serge D. Mechveliani" , > By openFile you, probably, mean openFd. Yes, sorry! > Another point is the number of open files, for a long loop. ... > toA_IO = openFd "toA" WriteOnly Nothing defaultFileFlags ... > When applying axiomIO in a loop of 9000 strings, it breaks: > "too ma

Re: [Haskell-cafe] named pipe interface

2012-01-13 Thread Donn Cave
Quoth "Serge D. Mechveliani" , ... > Initially, I did the example by the Foreign Function Interface for C. > But then, I thought "But this is unnatural! Use plainly the standard > Haskell IO, it has everything". > > So, your advice is "return to FFI" ? Well, it turns out that the I/O system functi

Re: [Haskell-cafe] named pipe interface

2012-01-13 Thread Donn Cave
Quoth "Serge D. Mechveliani" , [ ... why in Haskell instead of FFI ... ] > Because it is a direct and the simplest approach. Why does one need a > foreign language, if all the needed functions are in the standard > Haskell library? The GHC Haskell library makes some compromises with normal I/O f

Re: [Haskell-cafe] named pipe interface

2012-01-12 Thread Donn Cave
Quoth "Serge D. Mechveliani" , > (I wonder: is this for beginn...@haskell.org ?) No, not really! As already mentioned, the use of UnsafePerformIO goes a little beyond what I think is its intended purpose, and I think you might have better luck here with a test program that illustrates the probl

Re: [Haskell-cafe] How to terminate the process group of aprocesscreated with createProcess?

2012-01-12 Thread Donn Cave
Quoth Brandon Allbery , > On Thu, Jan 12, 2012 at 06:56, André Scholz > wrote: > >>gid <- createProcessGroup pid >> >> but i get the error message: >> "createProcessGroup: permission denied" > the documentation for terminateProcess is incorrect and should not > mention process groups

Re: [Haskell-cafe] How to terminate the process group of a processcreated with createProcess?

2012-01-11 Thread Donn Cave
Quoth Brandon Allbery , ... > terminateProcess passes on the semantics of kill(2); on SVID-compliant (and > I think POSIX.1-compliant) systems, the negative of the process group > leader's process ID is used to signal the process group. Note that you may > need to arrange for your initial child p

Re: [Haskell-cafe] On the purity of Haskell

2011-12-30 Thread Donn Cave
Quoth Steve Horne , > On 30/12/2011 10:41, Bardur Arantsson wrote: >> >> This doesn't sound right to me. To me, a "side effect" is something >> which happens as a (intended or unintended) consequence of something >> else. An effect which you want to happen (e.g. by calling a procedure, >> or let

Re: [Haskell-cafe] On the purity of Haskell

2011-12-29 Thread Donn Cave
Quoth Steve Horne , > On 29/12/2011 18:41, Chris Smith wrote: ... >> On Thu, 2011-12-29 at 10:04 -0800, Donn Cave wrote: >>> We can talk endlessly about what your external/execution results >>> might be for some IO action, but at the formulaic level of a Haskell >>

Re: [Haskell-cafe] On the purity of Haskell

2011-12-29 Thread Donn Cave
Quoth Gregg Reynolds , .. > A minor point maybe, but germane to the original post (I hope). It isn't - I mean, I'm not really sure what your point is, but the example really returns the same IO value, not just one of the same type. Consider an example with implementation: wint :: Int -> IO In

Re: [Haskell-cafe] Windows: openFile gives permission deniedwhenfilein use

2011-12-29 Thread Donn Cave
Quoth Antoine Latter , ... > Would this program then loop: > > append fromFilePath toFilePath = do > str <- readFile fromFile > writeFile toFile str > > if 'from' and 'to' where the same file? > > Currently the locking prevents this. Do you mean, locking makes that work, or just makes it fail

Re: [Haskell-cafe] On the purity of Haskell

2011-12-29 Thread Donn Cave
Quoth Steve Horne , > On 29/12/2011 08:48, Heinrich Apfelmus wrote: ... >> Well, it's a matter of terminology: "impure" /= "has side effects". >> The ability of a language to describe side effects is not tied to its >> (im)purity. >> >> Again, purity refers to the semantics of functions (at run-t

Re: [Haskell-cafe] Windows: openFile gives permission denied whenfilein use

2011-12-29 Thread Donn Cave
Quoth Antoine Latter , ... >> http://www.haskell.org/pipermail/libraries/2011-October/016978.html >> >> ... wherein Ian Lynagh proposed to remove this feature and let the >> programmer enforce locking or not, as in other programming languages' >> base I/O libraries. This met with enthusiastic univ

Re: [Haskell-cafe] Windows: openFile gives permission denied whenfile in use

2011-12-29 Thread Donn Cave
Quoth Andrew Coppin , > On 29/12/2011 04:29 AM, Antoine Latter wrote: ... >> This bug and its discussion is similar, but not identical: >> http://hackage.haskell.org/trac/ghc/ticket/4363 > > This one has been rumbling on for ages. As others have said, the Report > demands that locking occur, which

Re: [Haskell-cafe] On the purity of Haskell

2011-12-29 Thread Donn Cave
Quoth Gregg Reynolds , > On Wed, Dec 28, 2011 at 2:44 PM, Heinrich Apfelmus > wrote: >> >> The beauty of the IO monad is that it doesn't change anything about purity. >> Applying the function >> >> bar :: Int -> IO Int >> >> to the value 2 will always give the same result: >> >> bar 2 = bar (1

Re: [Haskell-cafe] How to get Cabal to spit out a .a library suitable for linking into C/Objective-C

2011-12-26 Thread Donn Cave
Sorry about the belated response, but this shouldn't be a problem since it isn't going to be very helpful anyway! I've managed to follow the process described on this page: http://www.haskell.org/haskellwiki/Using_Haskell_in_an_Xcode_Cocoa_project to link Haskell code to a non-Haskell main program

Re: [Haskell-cafe] If you'd design a Haskell-like language, what would you do different?

2011-12-26 Thread Donn Cave
Quoth Hans Aberg, ... > For example, I set one entry so that typing x |-> a becomes x ↦ a, the > TeX \mapsto, in Unicode ↦ RIGHTWARDS ARROW FROM BAR U+21A6. > > It might be tedious to make a lot of entries, though, but something to > start with. Something to finish me with, too. I wouldn't b

Re: [Haskell-cafe] terminateProcess leaves zombie processes around

2011-12-07 Thread Donn Cave
Quoth Felipe Almeida Lessa , > On Wed, Dec 7, 2011 at 1:19 PM, Brandon Allbery wrote: >> They *do* terminate; a zombie is a dead process waiting for its parent to >> reap it with waitForProcess. There's also some POSIX stuff you can do to >> have them auto-reaped, but doing that correctly and por

Re: [Haskell-cafe] How to get a file path to the program invoked?

2011-12-04 Thread Donn Cave
Quoth wren ng thornton , > There was a discussion about this recently over on libraries@, IIRC. The > short answer is that, at present, there is no function to give you $0. > We'd like to add such a function, but it's not been done yet. > > Part of the problem is that, as Alexey says, the first

Re: [Haskell-cafe] Can't establish subprocess communication

2011-11-13 Thread Donn Cave
As mentioned by the first person to follow up, you need to set line buffering in the "copier" program. It's filling up its buffer while you write small lines to it - unlike the test run at the terminal prompt, where it's connected to a TTY device and therefore behaved differently. In a situation

Re: [Haskell-cafe] Getting started on Mac OSX

2011-11-11 Thread Donn Cave
Quoth hstenstrom , > I have a book on Haskell, and I've downloaded and installed Haskell Platform > for Mac OS X. What do I do now? > XCode is a requirement, and I have it, but I don't know how to run it. To > begin with, I want to test small examples from the book, using ghc or ghci. > I have re

Re: [Haskell-cafe] control-c only caught once -- bug?

2011-10-30 Thread Donn Cave
Quoth Brian Johnson , ... > On further thought, there is something sensible here: the RTS might crash > while trying to exit. I propose, for POSIX environments, the following > change to SIGINT handling: > > * SIGINT is transformed into UserInterrupt during normal program execution > * Once the RT

Re: [Haskell-cafe] control-c only caught once -- bug?

2011-10-29 Thread Donn Cave
wrote: > The second time I press control-c, it isn't caught -- the program exits > instead. Why? I don't know why. Same behavior on my platform (Haiku.) While I imagine someone intimately acquainted with RTS signal handling might be able to explain it, I think the real problem is that Control

Re: [Haskell-cafe] instance Enum Double considerednotentirelygreat?

2011-09-27 Thread Donn Cave
Quoth Chris Smith , ... > I certainly don't agree that wanting the exact value from a floating > point type is a reasonable expectation. The *only* way to recover those > results is to do the math with the decimal or rational values instead of > floating point numbers. You'll get the rounding err

Re: [Haskell-cafe] instance Enum Double considered notentirelygreat?

2011-09-27 Thread Donn Cave
Quoth Chris Smith , ... > So that's what this is about: do we think of Float as an approximate > real number type, or as an exact type with specific values. If the > latter, then "of course" you exclude the value that's larger than the > upper range. If the former, then using comparison operators

Re: [Haskell-cafe] instance Enum Double considered not entirelygreat?

2011-09-26 Thread Donn Cave
Quoth "Richard O'Keefe" , [ ... re " Why would you write an upper bound of 0.3 on a list if you don't expect that to be included in the result? " ] > Because upper bounds are *UPPER BOUNDS* and are NOT as a rule included > in the result. If you write [0,2..9] you > - DO expect 0 in the r

Re: [Haskell-cafe] instance Enum Double considered not entirelygreat?

2011-09-20 Thread Donn Cave
Quoth Chris Smith , ... > As for Enum, if someone were to want a type class to represent an > enumeration of all the values of a type, then such a thing is reasonable > to want. Maybe you can even reasonably wish it were called Enum. But > it would be the *wrong* thing to use as a desugaring for

Re: [Haskell-cafe] efficient chop

2011-09-14 Thread Donn Cave
Quoth Ivan Lazar Miljenovic , > Why the extra case for go? The otherwise guard can be part of the > second case... I noticed that myself, so I thought "let's see if it's just a matter of style that comes out the same after compilation ..." ... and after a few minutes fooling around with that, I

Re: [Haskell-cafe] Trouble with readProcess

2011-08-11 Thread Donn Cave
Quoth Charles-Pierre Astolfi , > I've found my mistake: I was calling readProcess cmd ["-p -t"] instead > of readProcess cmd ["-p","-t"] That would do it. > Not sure what are the semantics of quotation in this case, though. And > I'm pretty sure my analysis is wrong because of that :) The princ

Re: [Haskell-cafe] Trouble with readProcess

2011-08-11 Thread Donn Cave
Quoth Charles-Pierre Astolfi , > readProcess cmd [opt1,opt2] seems to execute the following: > $ cmd "opt1" "opt2" > > That is usually fine, but I'm using an external program that doesn't > understand the quotes, so I need to execute instead: > $ cmd opt1 opt2 > > How should I do that? I think yo

Re: [Haskell-cafe] State of play with Haskell-Cocoa (Objective-C)bindings?

2011-07-31 Thread Donn Cave
Quoth Luke Evans , > I'm planning to start an Objective-C/Cocoa project and would like to > write it in Haskell as much as possible. > > Of course, I can contrive to split the project into app logic (Haskell) > and UI (Objective-C) with some sort of minimal interface between them; > possibly just p

Re: [Haskell-cafe] Stack space overflow in HaskellNet

2011-07-27 Thread Donn Cave
Quoth Manfred Lotz , > In the end the only thing I need is to get the full message because I > want to feed bogofilter to learn that a message is ham or spam. > > For the time being I decided to write my own program to fetch the data > because it is a good exercise for a Haskell beginner as I am.

Re: [Haskell-cafe] Stack space overflow in HaskellNet

2011-07-27 Thread Donn Cave
Quoth Manfred Lotz , ... > The problem seems to lie in the HaskellNet package. If for example I > only fetch a specific message >m <- fetch con 2092 > having a size of some 1.2m then I get the same stack overflow. > > If at runtime I specify +RTS -K40M -RTS it works but takes over 40 > seconds

Re: [Haskell-cafe] XCode Dependency for HP on Mac - old XCodeversions

2011-07-27 Thread Donn Cave
Quoth Clive Brettingham-Moore , >> To get XCode on my 10.6 machine, I... >> > I had quite a hunt recently to find the most recent XCode for my > not-so-recent mac... so I'll share what I found: Were you able to look on your install CD? Donn __

Re: [Haskell-cafe] Stack space overflow in HaskellNet

2011-07-26 Thread Donn Cave
Quoth Manfred Lotz , ... > I'm not quite sure I understand what you mean. Stack overflow comes > from this: > forM_ msgs (\x -> fetch con x >>= print) > > If I change it to: > mapM_ (\x -> fetch con x >>= print) msgs > > there is the same stack overflow. I didn't understand that m

Re: [Haskell-cafe] partial inheritance

2011-07-18 Thread Donn Cave
Quoth "Richard O'Keefe" , [ ... re Werner Kuhn "An Image-Schematic Account of Spatial Categories" ... ] > class BUILDING building where > > class BUILDING house => HOUSE house where > > any instance of HOUSE *will* have in its interface everything that > any instance of BUILDING will. But .

Re: [Haskell-cafe] Why aren't files flushed at exit?

2011-07-17 Thread Donn Cave
Quoth Felipe Almeida Lessa , > On Sun, Jul 17, 2011 at 10:41 AM, Paul Johnson wrote: >> If you open a file for writing and then exit with output unflushed, then >> Haskell does not flush the file for you.  In ghci the program seems to work, >> but then when you compile it in ghc it mysteriously f

Re: [Haskell-cafe] FFI for a beginner

2011-07-14 Thread Donn Cave
>> The docs >> >> say that -#include pragmas no longer work, but fail to explain how to >> load code without them. Suffice to say I have no recourse but trial >> and error." > > Ah, now that is a GHC doc

Re: [Haskell-cafe] how to change a process name

2011-07-07 Thread Donn Cave
Quoth Kazu Yamamoto (=?iso-2022-jp?B?GyRCOzNLXE9CSScbKEI=?=) , > I would like to know how to change a process name in Haskell. When we > are programming in C, we can change it by overriding argv on Unix. > But I cannot find the same way to do in Haskell. Can anyone suggest > how in Haskell? I'm no

Re: [Haskell-cafe] How to ensure code executes in the context ofaspecific OS thread?

2011-07-06 Thread Donn Cave
Quoth Brandon Allbery , ... > I don't know about the general case, but OS X does treat the main > thread specially here; the (native, not X11) framework sets up the > connection to Core Graphics in the main thread before invoking the > main program, so you can't make whatever it is (thread local st

Re: [Haskell-cafe] How to ensure code executes in the context of aspecific OS thread?

2011-07-06 Thread Donn Cave
Quoth =?ISO-8859-1?Q?G=E1bor_Lehel?= , ... > Stated another way: I suspect most GUI libraries don't really actually > care that you only execute GUI code from the main OS thread, as much > as they care that only one (thread-unsafe) GUI function is being > called at any given time. If you only ever

Re: [Haskell-cafe] How to ensure code executes in the context of aspecific OS thread?

2011-07-06 Thread Donn Cave
Quoth Jason Dagit , ... > Yes. From my perspective (that of a library writer) that's what makes > this tricky in GHCi. I need GHCi's cooperation. From GHCi's > perspective it's tricky too. It seems to me that ideally, GHCi would do its thing in a child thread, like the extra runtime threads, an

Re: [Haskell-cafe] Replacing stdin from within Haskell

2011-06-09 Thread Donn Cave
Quoth Erik Hesselink , > On Thu, Jun 9, 2011 at 13:40, Neil Davies > wrote: >> Anyone out there got an elegant solution to being able to fork a haskell >> thread and replace its 'stdin' ? > > If you don't mind being tied to GHC you can use hDuplicateTo from > GHC.IO.Handle [1]. You can also use

Re: [Haskell-cafe] OK! I have a Mac with Snow Leopard 10.6.7

2011-06-05 Thread Donn Cave
Quoth KC , > ... Xcode3.2.6, Haskell Platform 2011.2.0.1 > What are 2or 3 ways so far to get a GUI & graphics? http://www.haskell.org/haskellwiki/Using_Haskell_in_an_Xcode_Cocoa_project ... if you don't mind that there will be some Objective C involved. I have written only a very minor applicat

Re: [Haskell-cafe] How to install GhC on a Mac without registering?

2011-06-05 Thread Donn Cave
Quoth Chris Smith , > That's interesting... whatever the reason, though, I concur that using > Haskell seems much easier on Linux and Windows. I had to abandon a plan > to introduce Haskell in a class I taught this past semester because of > issues with getting it installed on the Macintosh lapto

Re: [Haskell-cafe] How to install GhC on a Mac without registering?

2011-06-03 Thread Donn Cave
Quoth Daniel Peebles , > I thought Apple had stopped bundling the dev tools with installation DVDs? Do you have an install DVD with no Xcode on it? I have it on a 10.6 DVD, when would this have happened (or stopped happening)? Quoth Nathan Howell , > XCode 4 is for sale in the App Store for $5.

Re: [Haskell-cafe] Status of Haskell + Mac + GUIs & graphics

2011-05-18 Thread Donn Cave
Quoth wren ng thornton , ... > But yes, the mere process of making bindings isn't especially > cumbersome. Anyone interested in prior art should take a look at the > Perl--ObjectiveC bridgework, CamelBones: > > http://camelbones.sourceforge.net/ Note (again) that there's already some work i

Re: [Haskell-cafe] Status of Haskell + Mac + GUIs & graphics

2011-05-18 Thread Donn Cave
Quoth =?iso-8859-1?Q?Jurri=EBn_Stutterheim?= , ... > So here's my (perhaps slightly provoking) question: do we need to > care at all about good GUI toolkits being available? Web applications, > especially with an HTML 5 front-end, have become increasingly more > powerful. If we can also find a good

Re: [Haskell-cafe] Question on a common pattern

2011-03-15 Thread Donn Cave
., or from the old thread mentioned earlier, a lambda with multiple definitions - fx >>= \ Opt1 -> ... Opt2 -> ... Donn Cave, d...@avvanta.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Question on a common pattern

2011-03-15 Thread Donn Cave
h of course is what we're trying to avoid with the case expression. I must have missed a trick with the layout? Donn Cave, d...@avvanta.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] How to daemonize a threaded Haskell program?

2011-03-05 Thread Donn Cave
ll programs. My current GHC can't compile -via-C, but if you can compile a minimal "main" module to C that way, it probably calls hs_main() or something like that? and you could add your own xx_main() to the stack. Donn Cave, d...@avvanta.com ___

Re: [Haskell-cafe] Why is there no "splitSeperator" function inData.List

2011-02-14 Thread Donn Cave
Quoth Peter Simons , ... > having a dictator is not a necessary prerequisite for the ability to > make decisions. It's quite possible to decide controversial matters > without a dictator -- say, by letting people vote. The problem might be slightly miscast here, as an inability to reach a decision

  1   2   3   4   >