Re: [Haskell-cafe] generics and sql

2011-04-24 Thread Edward Z. Yang
Hmm, this is a bit peculiar. The problem is you don't get control over how gmapQ invokes the function toSql: it will only ever be done with the type signature Data d = d - u. There is good reason for this too: imagined you tried to run gmapQ toSql on a data-type that contained a member that was

Re: [Haskell-cafe] generics and sql

2011-04-24 Thread Edward Z. Yang
Where did 'query' come from? Edward ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] More ideas for controlled mutation

2011-04-24 Thread Edward Z. Yang
message of Sun Apr 24 17:41:23 -0400 2011: Edward Z. Yang ezy...@mit.edu writes: I've been toying around with some ideas where we do alternative forms of controlled mutation. One such idea has to do with memoization. [..] Hash tables take advantage of this fact by simply chaining together

Re: GHC/LLDB integration

2011-04-20 Thread Edward Z. Yang
Hello William, You can find the state of the art (which isn't very advanced :-) in debugging GHC compiled code with GDB here: http://hackage.haskell.org/trac/ghc/wiki/Debugging/CompiledCode Maybe others can give more specific advice. Cheers, Edward Excerpts from William Knop's message of

Re: [Haskell-cafe] Killing threads in foreign calls.

2011-04-17 Thread Edward Z. Yang
This is a fairly nontrivial problem. First off, let me tell you what you do not /actually/ want to happen: you don't want the OS level thread performing the foreign call to actually be killed; most C code is not written a way that can gracefully recover from this, and unless you have explicit

C-- roundtripping: switch, if and other control flow statements

2011-04-15 Thread Edward Z. Yang
Hello all, I'm interested in improving GHC's C-- parser's support (and also making accomodations for the parser in our C-- pretty-printer) to the point where we can round-trip output from -ddump-opt-cmm with no semantic change. There are several roadblocks on the way here, but the one I'm

Re: [Haskell-cafe] Debugging with gdb?

2011-04-13 Thread Edward Z. Yang
Hello Svante, I have a few recommendations, places where I'd check: 1. Consult the arguments passed to read() usign GDB (your libc has debugging symbols) and see if they are obviously wrong. It seems more plausible that they are something that would be right for Linux, but not so right

Re: [Haskell-cafe] Current heap size and other runtime statistics -- API for accessing in GHC?

2011-04-10 Thread Edward Z. Yang
Simon Marlow and I had this conversation not too long ago, and the answer is no. However, this is definitely something that would be useful for a lot of people (GHC developers included!) Cheers, Edward Excerpts from Ryan Newton's message of Sun Apr 10 17:30:50 -0400 2011: Hi cafe, The

Re: [Haskell-cafe] Deciding equality of functions.

2011-04-09 Thread Edward Z. Yang
Excerpts from Grigory Sarnitskiy's message of Sat Apr 09 13:26:28 -0400 2011: I guess that deciding whether two functions are equal in most cases is algorithmically impossible. However maybe there exists quite a large domain of decidable cases? If so, how can I employ that in Haskell? In the

Re: Validate failures on the new codegen

2011-04-07 Thread Edward Z. Yang
Excerpts from Karel Gardas's message of Thu Apr 07 13:14:46 -0400 2011: OK! Thanks for the information. So this -fnew-codegen is this famous codegen which is using hoopl for data-dependency tracking or something like that if I understand correctly Yep. And which is producing just C-- in

Re: -DDEBUG and testsuite

2011-04-06 Thread Edward Z. Yang
checks for -dno-debug-output, though if some tests are checking for debug output, that might be tricky. Edward Excerpts from Simon Marlow's message of Tue Apr 05 15:35:45 -0400 2011: On 05/04/11 17:50, Edward Z. Yang wrote: Hello all, If I run 'make fast' in the testsuite, with a stage2

-DDEBUG and testsuite

2011-04-05 Thread Edward Z. Yang
Hello all, If I run 'make fast' in the testsuite, with a stage2 compiler that has been built with -DDEBUG, should I be getting extra failures? Edward ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org

Re: [Haskell-cafe] BlockedIndefinitelyOnMVar exception

2011-03-31 Thread Edward Z. Yang
I don't know if there's a way to disable it, but you can wrap all your spawned threads with an exception handler that catches BlockedIndefinitelyOnMVar and ignores it. If the thread blocks indefinitely, it's as good as dead, so there won't be any difference in behavior. Cheers, Edward

Re: FFI and LLVM

2011-03-30 Thread Edward Z. Yang
The main thing about FFI support is calling conventions, and LLVM supports a variety of them, so if your LLVM code is using a calling convention GHC supports, you should be able to manage it (there probably isn't any toolchain support though, so you'll have to build the LLVM bits manually and then

Re: [Haskell-cafe] How to best deal with nullPtr from alloca and friends?

2011-03-29 Thread Edward Z. Yang
Excerpts from Jason Dagit's message of Tue Mar 29 00:43:10 -0400 2011: I was reading up on the documentation for alloca and friends[1], which says, If any of the allocation functions fails, a value of

Re: [Haskell-cafe] ContT and ST stack

2011-03-11 Thread Edward Z. Yang
Excerpts from Max Bolingbroke's message of Fri Mar 11 05:15:34 -0500 2011: AFAIK this decision was reversed because SPJ found a simple way to support them. Indeed, they work fine in 7.0.2 and generate warnings. Correct. About a week-ish ago I submitted a patch to update the docs. Cheers,

Re: [Haskell-cafe] Rank-2 types in classes

2011-03-02 Thread Edward Z. Yang
The trick is to write the rank-2 type in the function that runs the monad, and leave the typeclasses skolemized. Here's an example: -- | Typeclass for monads that write or read to a network. Useful -- if you define operations that need to work for all such monads. -- You're expected to put

Re: [Haskell-cafe] Please review my Xapian foreign function interface

2011-02-21 Thread Edward Z. Yang
Excerpts from Oliver Charles's message of Mon Feb 21 08:53:48 -0500 2011: Yes, this is a concern to me as well. The only places I've used unsafePerformIO is with Query objects, which I am mostly treating as immutable data, and never exposing anyway to modify query objects. That is a good way

Re: [Haskell-cafe] Please review my Xapian foreign function interface

2011-02-20 Thread Edward Z. Yang
Thanks Oliver! I haven't had time to look at your bindings very closely, but I do have a few initial things to think about: * You're writing your imports by hand. Several other projects used to do this, and it's a pain in the neck when you have hundreds of functions that you

Tracing idea

2011-02-19 Thread Edward Z. Yang
I was thinking it might be useful if we had a per-thread circular buffer in memory for which we pushed a pointer to the info table we had just entered. In the event of a crash, you could dump the contents of the buffer to see what code had been recently executed. To reduce overhead, one might

Re: 4221 on new codegen

2011-02-01 Thread Edward Z. Yang
:44:41 -0500 2011: On 01/02/2011 00:01, Edward Z. Yang wrote: Current theory: c1jj: _s1ep::I32 = I32[(slot_s1ep::I32 + 4)]; // CmmAssign _s1fP::I32 = I32[(slot_s1fP::I32 + 4)]; // CmmAssign // outOfLine should follow: _s1eq::F64 = F64[_s1fP::I32 + 3

Re: 4221 on new codegen

2011-01-31 Thread Edward Z. Yang
Current theory: c1jj: _s1ep::I32 = I32[(slot_s1ep::I32 + 4)]; // CmmAssign _s1fP::I32 = I32[(slot_s1fP::I32 + 4)]; // CmmAssign // outOfLine should follow: _s1eq::F64 = F64[_s1fP::I32 + 3]; // CmmAssign I32[(youngc1jh + 4)] = c1jh; // CmmStore foreign

4221 on new codegen

2011-01-29 Thread Edward Z. Yang
Test 4221 (under the ffi folder) segfaults with the new codegen turned on. Before: 0xb7a68c78: 0x822fadc stg_ap_v_info 0xb7a68c74: 0xb7ab8f94 0xb7a68c70: 0xb7ab8fa4 0xb7a68c6c: 0x8134dc0 stT_info 0xb7a68c68: 0xb7ab8f94 0xb7a68c64: 0x822f9f4 stg_marked_upd_frame_info

Re: [Haskell-cafe] Conditionals and case expressions in do blocks

2011-01-26 Thread Edward Z. Yang
Excerpts from Edward Amsden's message of Wed Jan 26 15:51:46 -0500 2011: do ... case ... of Foo x - do ... ... return foobar Bar x - do ... ... return foobar There's not enough context here to say what is appropriate.

Re: [Haskell-cafe] Are constructors strict?

2011-01-20 Thread Edward Z. Yang
Hello Daryoush, That is a good question, and depends on distinguishing between laziness and nondeterminism. Suppose I have a normal, lazily evaluated list: [1,2...] There are thunks used in this case, but the end result is fully deterministic: the next will always be 3, and then 4, and so

Re: New codegen failing test-cases

2011-01-13 Thread Edward Z. Yang
Yep, switching inlineStmt u a (CmmCall target regs es srt ret) = CmmCall (infn target) regs es' srt ret where infn (CmmCallee fn cconv) = CmmCallee fn cconv infn (CmmPrim p) = CmmPrim p es' = [ (CmmHinted (inlineExpr u a e) hint) | (CmmHinted e hint) - es to inlineStmt u

Re: New codegen failing test-cases

2011-01-13 Thread Edward Z. Yang
Ok, I have a stage2 compiler built with the new codegen all the way, and here are the new failing cases: 1372(normal) 2047(normal) 4030(normal) OldException001(normal) async001(normal) bug1465(normal) cabal01(normal) cabal03(normal) cgrun016(normal) cgrun045(normal)

Re: New codegen failing test-cases

2011-01-13 Thread Edward Z. Yang
*you feel a sudden sense of deja vu* Here is my current play on things: - I can probably get a devel2 build with the new codegen turned on for everything. This list of errors is from that build. However, this build was originally failing, so I'm going to do a fresh devel2

Re: [Haskell-cafe] Misleading MVar documentation

2011-01-13 Thread Edward Z. Yang
Ok, here is an updated doc patch. I've also added a substantial introduction section. diff -rN -u old-base/Control/Concurrent/MVar.hs new-base/Control/Concurrent/MVar.hs --- old-base/Control/Concurrent/MVar.hs 2011-01-13 16:26:59.0 + +++ new-base/Control/Concurrent/MVar.hs

Re: New codegen failing test-cases

2011-01-12 Thread Edward Z. Yang
I appear to have tracked down the bug for ffi021: the new code generator doesn't appear to clear the tag bit for the pointer to heap before: // outOfLine should follow: (_sR1::I32,) = foreign ccall _sQR::I32((I32[_sRi::I32 + 7], `signed'),

Re: RFC: migrating to git

2011-01-12 Thread Edward Z. Yang
Excerpts from Roman Leshchinskiy's message of Wed Jan 12 18:20:25 -0500 2011: How would we get the current functionality of darcs-all pull? Is it even possible? Here is the rebase-y workflow. Untested, so I might have gotten one or two details wrong. Suppose I want to hack on GHC and base

Re: New codegen failing test-cases

2011-01-12 Thread Edward Z. Yang
With further poking, I think the new codegen is actually tickling an existing bug in the native code generator optimizations, since the cmmz output looks ok: cSH: _sQR::I32 = I32[_sRi::I32 + 3]; // CmmAssign _sQS::I32 = I32[_sRi::I32 + 7]; // CmmAssign

Re: [Haskell-cafe] Misleading MVar documentation

2011-01-12 Thread Edward Z. Yang
These are interesting, opposed perspectives, and I suspect what would be good is to treat both situations. I think perhaps what would be good to put in the introduction is the conceptual model of MVars: that is, take and put are the fundamental operations, and everything else is composed of them.

Re: [Haskell-cafe] ghci seg faulting, have no idea why.

2011-01-12 Thread Edward Z. Yang
If you load ghci into gdb, and then run it until the segfault, do you get any interesting backtrace? Did you recently run software updates? What happens if you reinstall GHC? Have you rebooted recently? Cheers, Edward Excerpts from Michael Litchard's message of Wed Jan 12 21:07:30 -0500 2011:

Re: New codegen failing test-cases

2011-01-11 Thread Edward Z. Yang
Hello Simon, Have you gotten a chance to look at these two hunks? (see below) Thanks, Edward Excerpts from Edward Z. Yang's message of Fri Dec 10 10:59:26 -0500 2010: Ok, I've got a patch that fixes this segfault. In the process I looked at all patches to Cg* modules after Nov 2009 and

Re: [Haskell-cafe] Set monad

2011-01-08 Thread Edward Z. Yang
Hello Peter, This is a classic problem with the normal monad type class. You can achieve this with restricted monads, but there is a bit of tomfoolery you have to do to get do-notation support for them. Here is some relevant reading: -

Re: [Haskell-cafe] Type System vs Test Driven Development

2011-01-05 Thread Edward Z. Yang
Haskell's type system makes large classes of traditional unit tests irrelevant. Here are some examples: - Tests that simply run code to make sure there are no syntax errors or typos, - Tests that exercise simple input validation that is handled by the type system, i.e.

Re: [Haskell-cafe] thread safety, IO arrays, and IO refs

2010-12-31 Thread Edward Z. Yang
If you need multithreaded mutable arrays, TArray may be a better choice, as the underlying stm implementation will manage locking for you. (The current implementation isn't terribly efficient, but when it gets better you'll get it for free too :-)

Re: [Haskell-cafe] Misleading MVar documentation

2010-12-25 Thread Edward Z. Yang
Wasn't that result John Launchbury's? I recalled hearing something similar as well. Cheers, Edward ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Misleading MVar documentation

2010-12-25 Thread Edward Z. Yang
Excerpts from Mitar's message of Fri Dec 24 23:18:43 -0500 2010: I am not sure if this are really race conditions? The point is that readMVar, withMVar and others do not return until they can return the value back and after that the value is the same as it was at the beginning of the call. So

[Haskell-cafe] Misleading MVar documentation

2010-12-24 Thread Edward Z. Yang
Merry Christmas all! Is it just me, or does the Control.Concurrent.MVar documentation seem a bit misleading? In particular, we should explicitly note the race conditions for not just swapMVar but also readMVar, withMVar, modifyMVar_ and modifyMVar, and clarify that the safety guarantees of the

Re: [Haskell-cafe] Misleading MVar documentation

2010-12-24 Thread Edward Z. Yang
Here is one suggested doc patch. Comments and revisions welcome: ezy...@javelin:~/Dev/ghc-clean/libraries/base/Control/Concurrent$ darcs whatsnew -u hunk ./Control/Concurrent/MVar.hs 59 {-| This is a combination of 'takeMVar' and 'putMVar'; ie. it takes the value - from the 'MVar', puts

Re: [Haskell-cafe] Making type-incompatible strategies interchangeable

2010-12-18 Thread Edward Z. Yang
Excerpts from Jacek Generowicz's message of Fri Dec 17 20:17:30 -0500 2010: Imagine an activity which may be performed either by a computer, or by a human (alternatively, either locally, or remotely across a network). From Haskell's type system's perspective, these two will look completely

Re: [Haskell-cafe] Infinite lists in real world programs

2010-12-15 Thread Edward Z. Yang
It sounds like a good fit for your problem as stated. One thing to note is that Haskell will give you great abstractions for very strong amounts of code, as long as what you want to do is a good fit for the abstraction. Haskell makes it quite hard to fit a square peg into a round hole, so if one

Re: [Haskell-cafe] Infinite lists in real world programs

2010-12-15 Thread Edward Z. Yang
Excerpts from Yves Parès's message of Wed Dec 15 13:28:11 -0500 2010: if one day you decide you need an agent that generates random numbers I could say that my agents now run in a certain monad, I just would have to transform my basic agents to : agent1 = liftM . fmap (*2) (or even agen1

Re: New codegen failing test-cases

2010-12-10 Thread Edward Z. Yang
Ok, I've got a patch that fixes this segfault. In the process I looked at all patches to Cg* modules after Nov 2009 and looked for changes that weren't applied to the new codegen. I skipped the LLVM patch, but picked up the rest of the blackhole changes. There are, however, two hunks that I am

MonoLocalBinds and hoopl

2010-12-09 Thread Edward Z. Yang
Hello all, Here's an experience report for porting hoopl to manage MonoLocalBinds. The Compiler.Hoop.XUtil module has a rather interesting (but probably common) style of code writing, along the lines of this: fbnf3 (ff, fm, fl) block = unFF3 $ scottFoldBlock (ScottBlock f m l cat) block

Re: New codegen failing test-cases

2010-12-09 Thread Edward Z. Yang
Here is the new set of failing test-cases on the shiny new branch. I should stick the merged branch somewhere; any suggestions? 4030(normal) 4221(normal) IndTypesPerf(normal) T1969(normal) T3064(normal) T3294(normal) T3736(normal) T3807(normal) T4003(normal)

Re: New codegen failing test-cases

2010-12-09 Thread Edward Z. Yang
Ok, looking at 4030, which is this simple program: main = do tid - block $ forkIO $ let x = x in x killThread tid It segfaults in stg_BLACKHOLE_info when attempting to dereference... something (I haven't quite figured out what yet; what's usually stored in 0x4(%esi) on 32-bit x86 when

RE: [darcs-users] How to develop on a (GHC) branch with darcs

2010-12-08 Thread Edward Z. Yang
I like Git for Computer Scientists [1] and Git in pictures [2]. It also sounds like a Git for Darcs users might be in order. Edward [1] http://eagain.net/articles/git-for-computer-scientists/ [2] http://blog.nelhage.com/2010/01/git-in-pictures/ ___

Re: New codegen failing test-cases

2010-12-08 Thread Edward Z. Yang
I've done a bit more chewing away at the branch and have gotten to 19Sep10. Edward ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Re: New codegen failing test-cases

2010-12-08 Thread Edward Z. Yang
Final status report for tonight, before I crash in bed; I've managed to make it compile all the way to hoopl. It seems like hoopl doesn't typecheck anymore? I haven't been following the typechecker changes too closely so some guidance would be appreciated.

Re: New codegen failing test-cases

2010-12-04 Thread Edward Z. Yang
I get the same error for the other branch too. Cheers, Edward ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Re: New codegen failing test-cases

2010-12-04 Thread Edward Z. Yang
When I revert the PArr - ParallelArray changes in those directories, I then get: ghc-stage1: panic! (the 'impossible' happened) (GHC version 7.1.20101126 for i386-unknown-linux): match_co Cheers, Edward ___ Glasgow-haskell-users mailing list

Re: New codegen failing test-cases

2010-12-04 Thread Edward Z. Yang
Oh, that explains the co error! Thanks a bunch. Cheers, Edward ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Re: [Haskell-cafe] GHC 7.0.1 developer challenges

2010-12-04 Thread Edward Z. Yang
Excerpts from Brandon S Allbery KF8NH's message of Sat Dec 04 13:42:48 -0500 2010: We went over this some time back; the GHC runtime is wrong here, it should only disable flags when running with geteuid() == 0. Also, the current mechanism for specifying runtime flags at compile time is

New codegen failing test-cases

2010-12-03 Thread Edward Z. Yang
I fired up the new codegen and ran make fast on the regression suite and the following new tests started failing: 3207(normal) 4030(normal) cgrun016(normal) cgrun045(normal) cgrun051(normal) dsrun005(normal) dsrun007(normal) dsrun008(normal) exceptionsrun001(normal)

Re: [Haskell-cafe] Most images broken on haskellwiki pages

2010-12-03 Thread Edward Z. Yang
This was because, for some odd reason, the images were stored using absolute URLs and not real wikilinks. I've fixed most of them on that page. Edward ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: ANN: HaLVM 1.0: the Haskell Lightweight Virtual Machine

2010-11-30 Thread Edward Z. Yang
Great news and great stuff! Looking forward to playing around with it. Edward ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Re: [Haskell-cafe] GHC 7.0.1 developer challenges

2010-11-25 Thread Edward Z. Yang
Hello John, Arguably the correct thing to do is to use GHC's hooks for programatically specifying runtime options; unfortunately, because this has to run /before/ any Haskell code starts, it's a bit unwieldly: essentially you'll need a C stub file that scribbles the correct options into char

Re: [Haskell-cafe] category-extras clash with transformers

2010-11-20 Thread Edward Z. Yang
No, you're not totally screwed; you just need to bug xmonad-contrib and category-extras to fix their code. Edward ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: Terminate unused worker threads

2010-11-17 Thread Edward Z. Yang
Excerpts from Simon Marlow's message of Wed Nov 17 06:15:46 -0500 2010: I suggest keeping track of the number of items in the queue. Ok, I added a spare_workers_no field to the Capability struct. So I think the main thing missing is a call to workerTaskStop(). Added. It would be really nice

Re: Terminate unused worker threads

2010-11-17 Thread Edward Z. Yang
Hello Ryan, Adding the extra spare_workers_no field bookkeeping doesn't add very much overhead, since whenever spare_worker's is changing we already have taken out the lock. As for using a lock-free data structures, I can't say I have a good feel for how performance might change in that case.

Re: Signal handler scheduling on single-threaded RTS

2010-11-15 Thread Edward Z. Yang
Oh, there's quite a simple fix for this: don't have the FFI call handle the SIGINT; only handle a signal the RTS generates. I guess we should do a little more legwork to make sure interruptible(?) user threads don't see signals. Edward ___

Re: Signal handler scheduling on single-threaded RTS

2010-11-11 Thread Edward Z. Yang
Relatedly, it seems that it takes a nontrivial amount of time for the multithreaded RTS to realize that a thread has emitted a signal. I wonder if there's a more direct way an FFI call can say when I get back to Haskell, immediately start propagating an exception. Edward

Re: Odd behavior of ncurses with -threaded

2010-11-11 Thread Edward Z. Yang
Excerpts from Donn Cave's message of Thu Nov 11 17:07:20 -0500 2010: ghc: 6.12.1 linux: 2.6.32 ncurses: 5.7 Someone probably should. It's tempting to conclude that the bug is in ncurses, and perhaps it is, and maybe there's nothing to be done about it anyway, but a language

Signal handler scheduling on single-threaded RTS

2010-11-10 Thread Edward Z. Yang
I've been poking the bad behavior Brian described here: http://blog.ezyang.com/2010/08/interrupting-ghc/comment-page-1/#comment-1334 and in the process noticed something kind of interesting about thread scheduling in non-multithreaded mode (i.e. without -threaded). When the single-threaded

Terminate unused worker threads

2010-11-07 Thread Edward Z. Yang
I finally got some spare time to do some GHC hacking, and after feeling my way around http://hackage.haskell.org/trac/ghc/ticket/4262 I came up with the following patch, which appears to work (that is, bound the number of worker threads hanging around after FFI calls): diff -rN -u

Re: [Haskell-cafe] Test command line programs

2010-10-26 Thread Edward Z. Yang
Hello Dupont, If your code follows good style and has kept as much code out of IO as possible, you should be able to easily unit test the pure portions of your code. Otherwise, classic integration tests, by setting up the network jigs yourself, is standard. Another little question: How can I

Re: [Haskell-cafe] Re: libefence useful for debugging ghc+ffi programs?

2010-10-20 Thread Edward Z. Yang
Excerpts from Johannes Waldmann's message of Wed Oct 20 05:13:36 -0400 2010: and indeed, gethostbyname is famous for being non re-entrant. If you have the time, this would be a great time to improve the multithreaded support of these libraries. In particular, glibc offers a re-entrant version

Re: [Haskell-cafe] Re: libefence useful for debugging ghc+ffi programs?

2010-10-20 Thread Edward Z. Yang
Hmm, in that case, one possibility is someone else did an FFI import of gethostbyname and isn't using the same lock. Can you check for that? Edward Excerpts from Johannes Waldmann's message of Wed Oct 20 16:17:06 -0400 2010: and indeed, gethostbyname is famous for being non re-entrant.

Re: [Haskell-cafe] Re: Should Yesod.Mail be a separate package?

2010-10-17 Thread Edward Z. Yang
I'm a bit partial to Swift Mailer [1]. It's useful to support multiple transport backends, especially in situations where sendmail is not portable. Cheers, Edward [1] http://swiftmailer.org/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] allocation for pure FFI functions

2010-10-14 Thread Edward Z. Yang
Excerpts from Johannes Waldmann's message of Thu Oct 14 13:45:46 -0400 2010: Is there a solution? Workaround? Better approach? If it boils down to unsafePerformIO, then where do I put it, and what should I watch out for? unsafePerformIO is your ticket here. The key is to ensure all of the

Re: [Haskell-cafe] Re-order type

2010-10-09 Thread Edward Z. Yang
Excerpts from André Batista Martins's message of Sat Oct 09 17:45:05 -0400 2010: Hello, exists any algorithm to determine how terms can be changed to safisty the type of one function? Your terminology is a little off: in particular, your example doesn't include any terms (which are

Re: [Haskell-cafe] HTML library with DOM?

2010-10-07 Thread Edward Z. Yang
Excerpts from Gregory Collins's message of Wed Oct 06 19:44:44 -0400 2010: I've got the month of October off, and one of the things I've been planning on working on is a compliant HTML5 parser for Haskell -- something which is sorely needed! I will ping the list back if/when I get it finished.

Re: Does GhcDebugged work?

2010-09-28 Thread Edward Z. Yang
Excerpts from Ian Lynagh's message of Tue Sep 28 13:18:17 -0400 2010: Yes, unless you make clean. (it works by putting Validating=YES in mk/are-validating.mk) Oof, ok, I bet that was what I was seeing. Thanks, Edward ___ Glasgow-haskell-users

Re: [Haskell-cafe] Non-strict evaluation and concurrency (STM) : conflict?

2010-09-28 Thread Edward Z. Yang
Excerpts from Romain Demeyer's message of Tue Sep 28 09:06:53 -0400 2010: That's what we want, but what is the explanation of this behavior? STM is designed to be optimistic, not blocking. So, does it means that the value is evaluated at commit-time? Do you know some problems that are related

Does GhcDebugged work?

2010-09-24 Thread Edward Z. Yang
I wasted an afternoon compiling GHC with GhcDebugged = YES in my mk/build.mk, only to have ghc-stage2 tell me it wasn't compiled with -debug. Looking at mk/config.mk.in, it seems that GhcDebugged is unconditionally set to NO. What am I doing wrong? Edward

Re: Interruptible GHC

2010-09-17 Thread Edward Z. Yang
Here's what the Windows version would look like (if I could get HEAD to build, that is :-) void interruptOSThread (OSThreadId id) { HANDLE hdl; PCSIO pCSIO; if (!(hdl = OpenThread(THREAD_TERMINATE,FALSE,id))) { sysErrorBelch(interruptOSThread: OpenThread);

Re: [Haskell-cafe] Stateful DSLs

2010-09-17 Thread Edward Z. Yang
Excerpts from Günther Schmidt's message of Fri Sep 17 13:27:45 -0400 2010: I'd want to create a EDSL where I want to be able to statically ensure that expressions can only be built according to a particular state. Like in a network application, SMTP client for example, where I can only

Re: [Haskell-cafe] Unified Haskell login

2010-09-17 Thread Edward Z. Yang
Excerpts from Neil Davies's message of Fri Sep 17 05:27:34 -0400 2010: Why not use kerberos? We find it works for us, integrates with web (natively or via WebAuth), remote command execution (remctl) and ssh - widely used, scales brilliantly. MIT uses Kerberos and it is quite nice to be

Re: Interruptible GHC

2010-09-16 Thread Edward Z. Yang
There are some invariants that are being violated by pthread_kill(id, SIGINT) and I'm having difficulty understanding them. I get the following errors: cd ./concurrent/should_run '/home/ezyang/Dev/ghc/inplace/bin/ghc-stage2' -fforce-recomp -dcore-lint -dcmm-lint -no-user-package-conf -rtsopts

Re: Interruptible GHC

2010-09-16 Thread Edward Z. Yang
It looks like the problem was that the default handler for SIGINT was scheduling code to run, when we really just wanted to get EINTR. I'm sketchily using SIGPIPE right now; maybe we should use SIGUSR1 or something. Edward ___ Glasgow-haskell-users

Re: Interruptible GHC

2010-09-15 Thread Edward Z. Yang
Excerpts from Simon Marlow's message of Wed Sep 15 04:34:06 -0400 2010: It's not clear to me when to emit the warning: the system we're compiling on is not necessarily the one we're going to run on. This is more often the case for us where we're building distributions, than for other

Re: Interruptible GHC

2010-09-14 Thread Edward Z. Yang
Excerpts from Simon Marlow's message of Mon Sep 13 05:10:13 -0400 2010: The idea of having user-definable cancellation mechanisms seems quite sensible, given that we have so many ways to do this. However it seems quite hard in practice: for pthread_cancel, the RTS has to behave quite

Re: how to terminate an external program after timeout?

2010-09-14 Thread Edward Z. Yang
A possible cute solution would be to ulimit the processes permitted cpu time. Cheers, Edward ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Re: [Haskell-cafe] Re: Cleaning up threads

2010-09-14 Thread Edward Z. Yang
Excerpts from Ertugrul Soeylemez's message of Mon Sep 13 03:03:11 -0400 2010: In general it's better to avoid using killThread. There are much cleaner ways to tell a thread to exit. This advice doesn't really apply to Haskell: in fact, the GHC developers have thought really carefully about

Interruptible GHC

2010-09-11 Thread Edward Z. Yang
So I did a writeup of what I thought might be the next direction to go with the interruptible patch: http://blog.ezyang.com/2010/09/towards-platform-agnostic-interruptibility/ The really interesting bit (which I didn't cover) is what information to give to the user functioSo I did a writeup

Re: SIGALRM, SIGVTALRM, and third party libraries

2010-09-08 Thread Edward Z. Yang
Excerpts from Simon Marlow's message of Wed Sep 08 03:40:42 -0400 2010: Maybe. As a first step I think we could just document what happens when a call is interrupted (pthread_cancel() on POSIX, ??? on Windows) and let the user handle it. Is there even a good lowest-common-denominator that

Re: [Haskell-cafe] Re: ghc HEAD

2010-09-07 Thread Edward Z. Yang
Excerpts from Johannes Waldmann's message of Tue Sep 07 10:38:47 -0400 2010: Yuras Shumovich shumovichy at gmail.com writes: http://hackage.haskell.org/trac/ghc/ticket/3910 So what is the magic link-time flag to en/disable the RTS options? As you mentioned earlier, -rtsopts. It seems it

Re: SIGALRM, SIGVTALRM, and third party libraries

2010-09-06 Thread Edward Z. Yang
Excerpts from Simon Marlow's message of Mon Sep 06 05:57:59 -0400 2010: What did you have in mind with respect to portable equivalents of pthread functions? I'm not sure we need to do anything along these lines at all, and I'd much rather we didn't enforce any threading abstraction on

Re: [Haskell-cafe] circular imports

2010-09-06 Thread Edward Z. Yang
Excerpts from Evan Laforge's message of Mon Sep 06 13:30:43 -0400 2010: I feel like the circular imports problem is worse in haskell than other languages. Maybe because there is a tendency to centralize all state, since you need to define it along with your state monad. But the state monad

Re: SIGALRM, SIGVTALRM, and third party libraries

2010-09-03 Thread Edward Z. Yang
Excerpts from Bryan O'Sullivan's message of Fri Sep 03 17:00:03 -0400 2010: What I am wondering is if there's a practical downside to doing this. Am I going to accidentally kill something? This is a very important gap in the usability of GHC with native libraries, and if this approach actually

Re: FFI, signals and exceptions

2010-09-01 Thread Edward Z. Yang
I cooked up a Darcs patch implementing the new language keyword 'interruptible' sans tests, Windows support and avoiding executing interruptible calls on bound worker threads. However, being a Darcs newbie I ended up sending the patch to cvs-ghc, not this list. Let me know if you'd like me to

Re: FFI, signals and exceptions

2010-08-31 Thread Edward Z. Yang
Excerpts from Simon Marlow's message of Tue Aug 31 05:02:13 -0400 2010: I think the idea of annotating interruptible calls should be good enough. Simple blocking system calls like read can all be annotated as interruptible without any problems. Also, pthread_cancel() provides ways to

Re: FFI, signals and exceptions

2010-08-28 Thread Edward Z. Yang
Excerpts from Simon Marlow's message of Fri Aug 27 04:05:46 -0400 2010: You should walk cap-suspended_ccalls instead, no lock is required for that. For stress testing, you want to construct an example that has lots of threads making foreign cals and other threads calling throwTo to

Re: FFI, signals and exceptions

2010-08-26 Thread Edward Z. Yang
Here is a possible implementation: Task *task = NULL; blockedThrowTo(cap,target,msg); if (target-bound) { // maybe not supposed to kill bound threads, but it // seems to work ok (as long as they don't want to try // to recover!) task =

Re: FFI, signals and exceptions

2010-08-26 Thread Edward Z. Yang
Excerpts from Simon Marlow's message of Thu Aug 26 04:08:06 -0400 2010: You don't want to do this for a bound thread (when target-bound != NULL), because the OS thread will have interesting things on its C stack and pthread_cancel discards the entire stack. A worker thread on the other

Re: FFI, signals and exceptions

2010-08-26 Thread Edward Z. Yang
Ahem, the logic in that last iteration was not quite correct. Here is the more correct version: case BlockedOnCCall: case BlockedOnCCall_NoUnblockExc: { #ifdef THREADED_RTS Task *task = NULL; if (!target-bound) { // walk all_tasks to find the correct worker

Re: FFI, signals and exceptions

2010-08-25 Thread Edward Z. Yang
Excerpts from Simon Marlow's message of Mon Aug 09 11:23:42 -0400 2010: That might be quite interesting to try, actually. You'll need to modify the RTS: the place where we decide what to do when a throwTo is received for a thread involved in a foreign call is around line 396 of

<    1   2   3   4   >