Re: [Haskell-cafe] mtl: Why there is Monoid w constraint in the definition of class MonadWriter?

2012-12-08 Thread Edward Z. Yang
Excerpts from Holger Siegel's message of Sat Dec 08 15:27:38 -0800 2012: For deriving a monoid instance of w from monad (Writer w), you will need function execWriter:: Writer w a - w, but in case of a general instance of (MonadWriter w m) you would have to use function listen :: m a - m (a, w)

Re: [Haskell-cafe] Problem with benchmarking FFI calls with Criterion

2012-11-23 Thread Edward Z. Yang
Hello Janek, What happens if you do the benchmark without unsafePerformIO involved? Edward Excerpts from Janek S.'s message of Fri Nov 23 10:44:15 -0500 2012: I am using Criterion library to benchmark C code called via FFI bindings and I've ran into a problem that looks like a bug. The

Re: [Haskell-cafe] Problem with benchmarking FFI calls with Criterion

2012-11-23 Thread Edward Z. Yang
Running the sample code on GHC 7.4.2, I don't see the one fast, rest slow behavior. What version of GHC are you running? Edward Excerpts from Janek S.'s message of Fri Nov 23 13:42:03 -0500 2012: What happens if you do the benchmark without unsafePerformIO involved? I removed

Re: Using DeepSeq for exception ordering

2012-11-08 Thread Edward Z. Yang
It looks like the optimizer is getting confused when the value being evaluated is an IO action (nota bene: 'evaluate m' where m :: IO a is pretty odd, as far as things go). File a bug? Cheers, Edward Excerpts from Albert Y. C. Lai's message of Thu Nov 08 10:04:15 -0800 2012: On 12-11-08 01:01

Re: Using DeepSeq for exception ordering

2012-11-07 Thread Edward Z. Yang
Hello Simon, I think the confusion here is focused on what exactly it is that the NFData class offers: class NFData a where rnf :: a - () rnf can be thought of a function which produces a thunk (for unit) which, when forced, fully evaluates the function. With this in hand, it's pretty

[Haskell] [Haskell-cafe] Monad.Reader #21 call for copy

2012-10-20 Thread Edward Z. Yang
Call for Copy: The Monad.Reader - Issue 21 Whether you're an established academic or have only just started learning Haskell, if you have something to say, please consider writing an article for The Monad.Reader! The submission deadline for Issue 21

[Haskell-cafe] Monad.Reader #21 call for copy

2012-10-20 Thread Edward Z. Yang
Call for Copy: The Monad.Reader - Issue 21 Whether you're an established academic or have only just started learning Haskell, if you have something to say, please consider writing an article for The Monad.Reader! The submission deadline for Issue 21

Re: [Haskell-cafe] Haskell with all the safeties off

2012-09-07 Thread Edward Z. Yang
Haskell already does this, to some extent, in the design of imprecise exceptions. But note that bottom *does* have well defined behavior, so these optimizations are not very desirable. Edward Excerpts from David Feuer's message of Thu Sep 06 19:35:43 -0400 2012: I have no plans to do such a

Re: [Haskell-cafe] Haskell with all the safeties off

2012-09-07 Thread Edward Z. Yang
Excerpts from David Feuer's message of Fri Sep 07 12:06:00 -0400 2012: They're not *usually* desirable, but when the code has been proven not to fall into bottom, there doesn't seem to be much point in ensuring that things will work right if it does. This sort of thing only really makes sense

Re: [Haskell-cafe] Combining State and List Monads

2012-08-25 Thread Edward Z. Yang
Ah, egg in my face, I appear to have misremembered how ListT is implemented ^_^ http://www.haskell.org/haskellwiki/ListT_done_right may be relevant. Edward Excerpts from Edward Z. Yang's message of Sat Aug 25 01:51:40 -0400 2012: Hello Henry, In such cases, it is often worth thinking about

[Haskell-cafe] ANN: Monad.Reader Issue 20

2012-08-25 Thread Edward Z. Yang
*It’s not dead, it’s resting!* I am pleased to announce that Issue 20 of the Monad Reader is now available. http://themonadreader.files.wordpress.com/2012/08/issue20.pdf Issue 20 consists of the following three articles: - Enumeration of Tuples with Hyperplanes by Tillmann Vogt -

Re: [Haskell-cafe] Combining State and List Monads

2012-08-24 Thread Edward Z. Yang
Hello Henry, In such cases, it is often worth thinking about how you would implement such a scheme manually, without using pre-existing monads. You will quickly see that the two candidate types: s - ([a], s) [s - (a, s)] both will not work (exercise: what semantics do they give?) In

Re: [GHC Users] Dictionary sharing

2012-06-29 Thread Edward Z. Yang
Hello Jonas, Like other top-level definitions, these instances are considered CAFs (constant applicative forms), so these instances will in fact usually be evaluated only once per type X. import System.IO.Unsafe class C a where dflt :: a instance C Int where dflt =

Re: [GHC Users] Dictionary sharing

2012-06-29 Thread Edward Z. Yang
differently? Regards, Jonas On 29 June 2012 15:55, Edward Z. Yang ezy...@mit.edu wrote: Hello Jonas, Like other top-level definitions, these instances are considered CAFs (constant applicative forms), so these instances will in fact usually be evaluated only once per type X.    import

Re: [Haskell-cafe] mapping a concept to a type

2012-05-18 Thread Edward Z. Yang
I find both heavy and redundant. The first forces me to specify if I want an argument of not (with the constructors MR and NR) I'm sorry, I don't understand what you mean here. Do you know of a construction/abstraction that allows having or not an argument (a variable number of arguments,

Re: Weird behavior of the NonTermination exception

2012-05-03 Thread Edward Z. Yang
Excerpts from Bas van Dijk's message of Thu May 03 11:10:38 -0400 2012: As can be seen, the putMVar is executed successfully. So why do I get the message: thread blocked indefinitely in an MVar operation? GHC will send BlockedIndefinitelyOnMVar to all threads involved in the deadlock, so it's

Re: [Haskell-cafe] [Haskell-beginners] Is it only one data structure per ST monad?

2012-04-23 Thread Edward Z. Yang
If you mean, per 'ST s a', no: you can generate as many STRefs as you want. Edward Excerpts from KC's message of Mon Apr 23 14:32:57 -0400 2012: Is it only one data structure per ST monad? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: containing memory-consuming computations

2012-04-20 Thread Edward Z. Yang
So, it would be pretty interesting if we could have an ST s style mechanism, where the data structure is not allowed to escape. But I wonder if this would be too cumbersome for anyone to use. Edward Excerpts from Simon Marlow's message of Fri Apr 20 06:07:20 -0400 2012: On 19/04/2012 11:45,

Re: containing memory-consuming computations

2012-04-20 Thread Edward Z. Yang
Excerpts from Brandon Allbery's message of Fri Apr 20 19:31:54 -0400 2012: So, it would be pretty interesting if we could have an ST s style mechanism, where the data structure is not allowed to escape. But I wonder if this would be too cumbersome for anyone to use. Isn't this what

Invariants for GHC.Event ensureIOManagerIsRunning

2012-04-13 Thread Edward Z. Yang
Hello all, I recently ran into a rather reproduceable bug where I would get this error from the event manager: /dev/null: hClose: user error (Pattern match failure in do expression at libraries/base/System/Event/Thread.hs:83:3-10) The program was doing some rather strange things: - It

Re: Interpreting the strictness annotations output by ghc --show-iface

2012-03-07 Thread Edward Z. Yang
Check out compiler/basicTypes/Demand.lhs Cheers, Edward Excerpts from Johan Tibell's message of Wed Mar 07 18:21:56 -0500 2012: Hi, If someone could clearly specify the exact interpretation of these LLSL(ULL) strictness/demand annotations shown by ghc --show-iface I'd like to try to write

Re: Interpreting the strictness annotations output by ghc --show-iface

2012-03-07 Thread Edward Z. Yang
This is the important bit of code in the file: instance Outputable Demand where ppr Top = char 'T' ppr Abs = char 'A' ppr Bot = char 'B' ppr (Defer ds) = char 'D' ppr ds ppr (Eval ds) = char 'U' ppr ds ppr (Box (Eval ds)) =

Re: Interpreting the strictness annotations output by ghc --show-iface

2012-03-07 Thread Edward Z. Yang
Arguably, what should happen is we redo the format for machine-parseability and use that in future versions of GHC. Edward Excerpts from Johan Tibell's message of Wed Mar 07 23:38:06 -0500 2012: Thanks Edward. I'll try to summarize this in human readable form and publish it on the wiki. --

[Haskell] [Haskell-cafe] Monad.Reader #20 - DEADLINE EXTENSION

2012-03-07 Thread Edward Z. Yang
Call for Copy: The Monad.Reader - Issue 20 - DEADLINE EXTENSION --- Whether you're an established academic or have only just started learning Haskell, if you have something to say, please consider writing an article for The Monad.Reader!

[Haskell-cafe] Monad.Reader #20 - DEADLINE EXTENSION

2012-03-07 Thread Edward Z. Yang
Call for Copy: The Monad.Reader - Issue 20 - DEADLINE EXTENSION --- Whether you're an established academic or have only just started learning Haskell, if you have something to say, please consider writing an article for The Monad.Reader!

[Haskell] Second Monad.Reader #20 call for copy

2012-02-21 Thread Edward Z. Yang
Second Call for Copy: The Monad.Reader - Issue 20 - Whether you're an established academic or have only just started learning Haskell, if you have something to say, please consider writing an article for The Monad.Reader! The submission deadline

[Haskell-cafe] Second Monad.Reader #20 call for copy

2012-02-21 Thread Edward Z. Yang
Second Call for Copy: The Monad.Reader - Issue 20 - Whether you're an established academic or have only just started learning Haskell, if you have something to say, please consider writing an article for The Monad.Reader! The submission deadline

Re: [Haskell-cafe] Monad-control rant

2012-01-29 Thread Edward Z. Yang
Excerpts from Mikhail Vorozhtsov's message of Sun Jan 29 05:34:17 -0500 2012: You are trying to make bottoms a new null pointers. Sometimes it just doesn't worth the effort (or depends on the interpreter you use). I want to have the option to say: sorry, in this particular case (monad) I

Re: [Haskell-cafe] Terminology: different levels of strictness

2012-01-27 Thread Edward Z. Yang
There are some terms for these cases, but they are a bit ad hoc. length is what we might call spine-strict; head is head-strict. Projection analysis takes the approach that we can more precisely characterize the strictness only by considering both what is passed to the function as input, as well

Re: [Haskell-cafe] Monad-control rant

2012-01-24 Thread Edward Z. Yang
Excerpts from Mikhail Vorozhtsov's message of Tue Jan 24 07:26:35 -0500 2012: Sure, but note that evaluate for IO is implemented with seq# under the hood, so as long as you actually get ordering in your monad it's fairly straightforward to implement evaluate. (Remember that the ability

Re: Is it true that an exception is always terminates the thread?

2012-01-23 Thread Edward Z. Yang
Excerpts from Heka Treep's message of Mon Jan 23 13:56:47 -0500 2012: adding the message queue (with Chan, MVar or STM) for each process will not help in this kind of imitation. Why not? Instead of returning a thread ID, send the write end of a Chan which the thread is waiting on. You can send

Re: Is it true that an exception is always terminates the thread?

2012-01-23 Thread Edward Z. Yang
Excerpts from Heka Treep's message of Mon Jan 23 15:11:51 -0500 2012: import Control.Monad.STM import Control.Concurrent import Control.Concurrent.STM.TChan spawn f = do mbox - newTChanIO forkIO $ f mbox

Re: Is it true that an exception is always terminates the thread?

2012-01-23 Thread Edward Z. Yang
Excerpts from Heka Treep's message of Mon Jan 23 16:20:51 -0500 2012: actor :: TChan String - IO () actor mbox = forever $ do putStrLn call to actor... msg - atomically $ do isEmpty - isEmptyTChan mbox if isEmpty then return Nothing else readTChan mbox = return . Just when

Re: Straight-line single assignment in C--

2012-01-21 Thread Edward Z. Yang
Excerpts from Edward Z. Yang's message of Fri Jan 20 23:44:02 -0500 2012: If multiple assignment is rare enough in straight line code, I might be able to take the conservative approach and just say a - used multiple times Which I don't think will cause any problems in the inlining step

Re: [Haskell-cafe] Monad-control rant

2012-01-21 Thread Edward Z. Yang
Excerpts from Mikhail Vorozhtsov's message of Sat Jan 21 09:25:07 -0500 2012: But I also believe that you can't use this as justification to stick your head in the sand, and pretend bottoms don't exist (regardless of whether or not we'rd talking about asynchronous exceptions.) The reason is

Re: Runtime performance degradation for multi-threaded C FFI callback

2012-01-20 Thread Edward Z. Yang
Hello Sanket, What happens if you run this experiment with 5 threads in the C function, and have GHC run RTS with -N7? (e.g. five C threads + seven GHC threads = 12 threads on your 12-core box.) Edward Excerpts from Sanket Agrawal's message of Tue Jan 17 23:31:38 -0500 2012: I posted this

Straight-line single assignment in C--

2012-01-20 Thread Edward Z. Yang
Hello all, I was wondering if the following style of register assignment ever shows up in C-- code generated by GHC: a = R1 I32[a] = 1 a = R2 I32[a] = 2 That is to say, there are two disjoint live ranges of a: we could rename all instances of a in the first and second lines to

Re: [Haskell-cafe] partial type annotations

2012-01-19 Thread Edward Z. Yang
Oleg has described a grody hack which achieves this effect. http://okmij.org/ftp/Haskell/types.html#partial-sigs I agree more first class support for this would be nice. Edward Excerpts from Nicholas Tung's message of Thu Jan 19 15:37:28 -0500 2012: Dear all, I wanted to voice

Re: [Haskell-cafe] Why were unfailable patterns removed and fail added to Monad?

2012-01-19 Thread Edward Z. Yang
Hello Gregory, The original (1998!) conversation can be found here: http://www.mail-archive.com/haskell@haskell.org/msg03002.html I think Simon Peyton-Jones' example really sums up the whole issue: But [MonadZero] really sticks in my craw. How can we explain this: f ::

Re: [Haskell-cafe] Why were unfailable patterns removed and fail added to Monad?

2012-01-19 Thread Edward Z. Yang
Oh, I'm sorry! On a closer reading of your message, you're asking not only asking why 'fail' was added to Monad, but why unfailable patterns were removed. Well, from the message linked: In Haskell 1.4 g would not be in MonadZero because (a,b) is unfailable (it can't fail to match). But

Re: [Haskell-cafe] Why were unfailable patterns removed and fail added to Monad?

2012-01-19 Thread Edward Z. Yang
Aw, that is really suboptimal. Have you filed a bug? Edward Excerpts from Michael Snoyman's message of Thu Jan 19 23:29:59 -0500 2012: On Fri, Jan 20, 2012 at 5:23 AM, Edward Z. Yang ezy...@mit.edu wrote: Oh, I'm sorry! On a closer reading of your message, you're asking not only asking why

Re: [Haskell-cafe] Why were unfailable patterns removed and fail added to Monad?

2012-01-19 Thread Edward Z. Yang
:41 AM, Edward Z. Yang ezy...@mit.edu wrote: Aw, that is really suboptimal.  Have you filed a bug? I think it's a feature, not a bug. When dealing with monads that provide nice[1] implementations of `fail`, you can (ab)use this to avoid writing a bunch of case expressions. I remember reading

[Haskell-cafe] Lifting IO (IO a) - IO a to m (m a) - m a with monad-control

2012-01-18 Thread Edward Z. Yang
Hello folks, I was curious whether or not it is possible to lift an arbitrary IO (IO a) - IO a function to MonadBaseControl IO m = m (m a) - m a. That is, implement a function: liftJoin :: MonadBaseControl mb m = (mb (mb (StM m a)) - mb (StM m a)) - m (m a) - m a The difficulty seems to be

Re: [Haskell-cafe] Monad-control rant

2012-01-18 Thread Edward Z. Yang
Excerpts from Mikhail Vorozhtsov's message of Wed Jan 18 08:47:37 -0500 2012: Well, that's the kind of language we live in. The denotation of our language always permits for bottom values, and it's not a terribly far jump from there to undefined and error foo. I don't consider the

[Haskell-cafe] REMINDER: Hac Boston from January 20-22 at MIT

2012-01-18 Thread Edward Z. Yang
I'd like to remind everyone that Hac Boston, a Haskell hackathon is being held January 20-22, 2012 at MIT (rooms 4-159 and 4-261) in Cambridge, MA. The hackathon will officially kick off at 2:30 Friday afternoon, and go until 5pm on Sunday with the occasional break for sleep. Everyone is welcome

Re: Runtime performance degradation for multi-threaded C FFI callback

2012-01-17 Thread Edward Z. Yang
Hmm, this kind of sounds like GHC is assuming that it has control over all of the threads, and when this assumption fails bad things happen. (We use lightweight threads, and use the operating system threads that map to pthreads sparingly.) I'm sure Simon Marlow could give a more accurate

Re: [Haskell-cafe] Monad-control rant

2012-01-16 Thread Edward Z. Yang
Hello Mikhail, Thanks for continuing to be willing to participate in a lively discussion. :-) Excerpts from Mikhail Vorozhtsov's message of Mon Jan 16 08:17:57 -0500 2012: On 01/16/2012 02:15 PM, Edward Z. Yang wrote: Anders and I thought a little more about your example, and we first wanted

Re: [Haskell-cafe] Monad-control rant

2012-01-15 Thread Edward Z. Yang
Hello Mikhail, Sorry, long email. tl;dr I think it makes more sense for throw/catch/mask to be bundled together, and it is the case that splitting these up doesn't address the original issue monad-control was designed to solve. ~ * ~ Anders and I thought a

Re: [Haskell-cafe] Monad-control rant

2012-01-10 Thread Edward Z. Yang
Excerpts from Mikhail Vorozhtsov's message of Tue Jan 10 09:54:38 -0500 2012: On 01/10/2012 12:17 AM, Edward Z. Yang wrote: Hello Mikhail, Hi. (Apologies for reviving a two month old thread). Have you put some thought into whether or not these extra classes generalize in a way

Re: [Haskell-cafe] Monad-control rant

2012-01-09 Thread Edward Z. Yang
Hello Mikhail, (Apologies for reviving a two month old thread). Have you put some thought into whether or not these extra classes generalize in a way that is not /quite/ as general as MonadBaseControl (so as to give you the power you need) but still allow you to implement the functionality you

[Haskell] [Haskell-cafe] Monad.Reader #20 call for copy

2012-01-04 Thread Edward Z. Yang
I'm pleased to announce that I, Edward Z. Yang, will be taking over Brent Yorgey's role as lead editor of the Monad Reader! Call for Copy: The Monad.Reader - Issue 20 Whether you're an established academic or have only just started learning Haskell

[Haskell-cafe] Monad.Reader #20 call for copy

2012-01-04 Thread Edward Z. Yang
I'm pleased to announce that I, Edward Z. Yang, will be taking over Brent Yorgey's role as lead editor of the Monad Reader! Call for Copy: The Monad.Reader - Issue 20 Whether you're an established academic or have only just started learning Haskell

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

2011-12-29 Thread Edward Z. Yang
Here's an alternative perspective to consider: consider some data structure, such as a queue. There are two ways you can implement this, one the imperative way, with mutators, and the other the purely functional way, with no destructive updates. The question then, I ask, is how easy does a

Re: [Haskell-cafe] strict, lazy, non-strict, eager

2011-12-24 Thread Edward Z. Yang
1. a function f is strict if f ⊥ = ⊥ 2. ⊥ represents any computation which does not terminate, i.e. an exception or an infinite loop 3. strict describes the denotational semantics People, could you please make up your mind already? It has been more than 13 years. I have to admit, I'm a

Re: [Haskell-cafe] ANNOUNCE: hxournal-0.5.0.0 - A pen notetaking program written in haskell

2011-12-15 Thread Edward Z. Yang
When I attempt to build on Ubuntu, I get: ezyang@javelin:~$ cabal install hxournal Resolving dependencies... Configuring hxournal-0.5.0.0... Preprocessing library hxournal-0.5.0.0... In file included from /usr/include/gtk-2.0/gdk/gdkscreen.h:32:0, from

Re: [Haskell-cafe] ANNOUNCE: hxournal-0.5.0.0 - A pen notetaking program written in haskell

2011-12-12 Thread Edward Z. Yang
Very fancy! I am a big fan of Xournal, so I will have to take this for a spin. Edward Excerpts from Ian-Woo Kim's message of Mon Dec 12 06:56:09 -0500 2011: Hi, everyone, I am very pleased to announce a pen notetaking program: hxournal, which is written entirely in haskell using gtk2hs.

Re: [Haskell-cafe] Recommended class instances for container type

2011-12-08 Thread Edward Z. Yang
I'd hazard that if you went 'containers' and looked at what instances were implemented, that would give you a good idea. :^) (For example, if you look at Data.MAp, it has NFData, Typeable2 and Data instances.) Edward Excerpts from Christoph Breitkopf's message of Thu Dec 08 11:12:06 -0500 2011:

Re: [Haskell-cafe] Partial statical linking

2011-12-01 Thread Edward Z. Yang
libgmp and libffi are external libraries not associated with Haskell, so I don't think -static (which is for Haskell libraries) applies to them. You'll have the same problem with any other sort of library of this type, like libdl and friends ;-) Edward Excerpts from Jason Dusek's message of Sat

Re: log time instead of linear for case matching

2011-10-09 Thread Edward Z. Yang
Excerpts from Greg Weber's message of Sun Oct 09 12:39:03 -0400 2011: So first of all I am wondering if a sum type comparison does in fact scale linearly or if there are optimizations in place to make the lookup constant or logarithmic. Second, I as wondering (for the routing case) if Haskell

Re: [Haskell-cafe] SMP parallelism increasing GC time dramatically

2011-10-05 Thread Edward Z. Yang
Ketil, For your particular problem, unevaluated thunks should be easy to check: dump a heap profile and look for a decreasing allocation of thunks. That being said, IntMap is spine strict, so that will all be evaluated, and if your threads are accessing disjoint keys there should be no

Re: [Haskell-cafe] DSL for data definition (e.g. compiling Haskell type defs into Google's protocol buffers type defs)

2011-10-04 Thread Edward Z. Yang
Just making sure: have you looked at the Data.Data module yet? Edward Excerpts from Karel Gardas's message of Tue Oct 04 12:02:34 -0400 2011: Hello, I'm trying to find out if it's possible to use Haskell data type definition capability to define types and compile defined types into

Re: [Haskell-cafe] Is it possible to represent such polymorphism?

2011-10-02 Thread Edward Z. Yang
What are you actually trying to do? This seems like a rather unusual function. Edward Excerpts from sdiyazg's message of Sun Oct 02 15:17:07 -0400 2011: Finally I got what I meant: class ExpandTuple t where type Result t expand :: t-Result t instance (Integral a)=ExpandTuple

Re: Cheap and cheerful partial evaluation

2011-08-24 Thread Edward Z. Yang
I think it would be a pretty interesting project. :^) Edward Excerpts from Ryan Newton's message of Wed Aug 24 15:18:48 -0400 2011: Ah, and there's no core-haskell facility presently? Thanks. On Wed, Aug 24, 2011 at 12:14 AM, Edward Z. Yang ezy...@mit.edu wrote: Since most of GHC's

Re: Cheap and cheerful partial evaluation

2011-08-23 Thread Edward Z. Yang
at 8:48 AM, Edward Z. Yang ezy...@mit.edu wrote: I think this ticket sums it up very nicely! Cheers, Edward Excerpts from Max Bolingbroke's message of Mon Aug 22 04:07:59 -0400 2011: On 21 August 2011 19:20, Edward Z. Yang ezy...@mit.edu wrote: And no sooner do I send this email

Re: Cheap and cheerful partial evaluation

2011-08-22 Thread Edward Z. Yang
I think this ticket sums it up very nicely! Cheers, Edward Excerpts from Max Bolingbroke's message of Mon Aug 22 04:07:59 -0400 2011: On 21 August 2011 19:20, Edward Z. Yang ezy...@mit.edu wrote: And no sooner do I send this email do I realize we have 'inline' built-in, so I can probably

Re: Cheap and cheerful partial evaluation

2011-08-21 Thread Edward Z. Yang
And no sooner do I send this email do I realize we have 'inline' built-in, so I can probably experiment with this right now... Edward Excerpts from Edward Z. Yang's message of Sun Aug 21 14:18:23 -0400 2011: Hello all, It occurred to me that it might not be too difficult to use GHC's

Re: What are the preconditions of newArray#

2011-08-21 Thread Edward Z. Yang
stg_newArrayzh in rts/PrimOps.cmm doesn't appear to give any indication, so this might be a good patch to add. But I'm curious: what would allocating Array#s of size 0 do? Null pointers? That sounds dangerous... Edward Excerpts from Johan Tibell's message of Fri Aug 19 11:04:48 -0400 2011: Hi,

Re: [Haskell-cafe] how to read CPU time vs wall time report from GHC?

2011-08-14 Thread Edward Z. Yang
Hello Wishnu, That is slightly odd. What CPU and operating system are you running on? Include Kernel versions if Linux. Cheers, Edward Excerpts from Wishnu Prasetya's message of Sun Aug 14 14:11:36 -0400 2011: Hi guys, I'm new in parallel programming with Haskell. I made a simple test

Re: [Haskell-cafe] how to read CPU time vs wall time report from GHC?

2011-08-14 Thread Edward Z. Yang
Ah, good catch. :-) Edward Excerpts from Iustin Pop's message of Sun Aug 14 14:25:02 -0400 2011: On Sun, Aug 14, 2011 at 08:11:36PM +0200, Wishnu Prasetya wrote: Hi guys, I'm new in parallel programming with Haskell. I made a simple test program using that par combinator etc, and was a

[Haskell-cafe] Error in the asynchronous exception operational semantics

2011-08-09 Thread Edward Z. Yang
Hello all, I was recently reading Asynchronous Exceptions as an Effect by Harrison, Allwein, Gill and Procter, and noticed at the end that they found an error in the operational semantics described in Asynchronous Exceptions in Haskell by the Simons and Andrew Moran. Does anyone know what this

Re: GHCJS

2011-08-02 Thread Edward Z. Yang
Excerpts from Victor Nazarov's message of Tue Aug 02 19:12:55 -0400 2011: I can parse arguments myself and throw the rest of them to parseDynamicFlags, but GHC's flags are really complicated and I'm not aware of any argument parsing library that can be used to filter out some specified flags

Re: hsc2hs and #include

2011-07-30 Thread Edward Z. Yang
This is supposed to get defined as a command line argument to the preprocessor, see compiler/main/DriverPipeline.hs. Are you saying you don't see it when you run hsc2hs? Maybe someone else is calling a preprocessor but missing some of these arguments... Edward

Re: hsc2hs and #include

2011-07-30 Thread Edward Z. Yang
PM, Edward Z. Yang ezy...@mit.edu wrote: This is supposed to get defined as a command line argument to the preprocessor, see compiler/main/DriverPipeline.hs.  Are you saying you don't see it when you run hsc2hs? Maybe someone else is calling a preprocessor but missing some

Re: Understanding behavior of BlockedIndefinitelyOnMVar exception

2011-07-25 Thread Edward Z. Yang
Hello Brandon, The answer is subtle, and has to do with what references are kept in code, which make an object considered reachable. Essentially, the main thread itself keeps the MVar live while it still has forking to do, so that it cannot get garbage collected and trigger these errors. Here

Re: Understanding behavior of BlockedIndefinitelyOnMVar exception

2011-07-24 Thread Edward Z. Yang
Excerpts from Felipe Almeida Lessa's message of Sun Jul 24 22:02:36 -0400 2011: Does anything change if you somehow force a GC sometime after good2? Perhaps with some calculation generating garbage, perhaps with performGC. IIRC, the runtime detects BlockedIndefinitelyOnMVar on GC. But I'm

Re: memory statistics via an API ?

2011-07-19 Thread Edward Z. Yang
Not currently, but I am planning on adding this functionality in the near future. Excerpts from Tim Docker's message of Wed Jul 20 13:44:41 -0400 2011: The +RTS -s runtime arguments give some useful details the memory usage of a program on exit. eg: 102,536 bytes allocated in the

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

2011-07-04 Thread Edward Z. Yang
Sounds like something that could use a GHC Trac feature request. Edward ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: Hoopl: Examples of wrapFR or wrapBR?

2011-06-25 Thread Edward Z. Yang
Hello Justin, If you grep Hoopl's source code for wrapFR and wrapBR, you can find uses of the methods. For example: thenFwdRw :: forall m n f. Monad m = FwdRewrite m n f - FwdRewrite m n f - FwdRewrite m n f -- @ end comb1.tex thenFwdRw

Re: Superclass equalities

2011-06-22 Thread Edward Z. Yang
Yay! This is very exciting :-) Edward Excerpts from Simon Peyton-Jones's message of Wed Jun 22 12:57:28 -0400 2011: Friends I have long advertised a plan to allow so-called superclass equalities. I've just pushed patches to implement them. So now you can write class (F a ~ b) = C a

Re: gitweb on darcs.haskell.org?

2011-06-21 Thread Edward Z. Yang
All of the GHC repos are mirrored to Github, which offers similar facilities. Of course, it wouldn't be too much work to setup gitweb on darcs.haskell.org, I don't think. Edward ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org

Re: MonoLocalBinds and hoopl

2011-06-17 Thread Edward Z. Yang
In case it wasn't clear, I'd very much be in favor of implementing this refinement. Cheers, Edward ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Re: MonoLocalBinds and hoopl

2011-06-14 Thread Edward Z. Yang
I ran into some more code like this, and I realized there was something pretty important: the majority of let-bindings do not have any free varaibles. They could very well be floated to the top level without having to make any source level changes. So maybe let should be generalized, if no free

Re: [Haskell-cafe] pool: Why doesn't it block?

2011-06-12 Thread Edward Z. Yang
The documentation seems to indicate that the behaviour should be blocking, so if it's not, might be a bug. withResource :: MonadCatchIO m = Pool a - (a - m b) - m b Temporarily take a resource from a Pool, perform an action with it, and return it to the pool afterwards. * If the

Re: [Haskell-cafe] pool: Why doesn't it block?

2011-06-12 Thread Edward Z. Yang
-Pool.html . My original intention of splitting pool off from persistent was so others could use it. If Bryan's maintaining resource-pool instead, I'd have no problem deprecating pool and using resource-pool in its place. Michael On Sun, Jun 12, 2011 at 12:06 PM, Edward Z. Yang ezy

Re: [Haskell-cafe] GHC7 build problem

2011-06-11 Thread Edward Z. Yang
Yes, the tree was broken for some time between yesterday and today, and you appear to have gotten unlikely. It should have been fixed now, so you should try again. Cheers, Edward Excerpts from Scott Lawrence's message of Sat Jun 11 12:44:18 -0400 2011: Trying to compile GHC7 from source (as

Re: [Haskell-cafe] GHC7 build problem

2011-06-11 Thread Edward Z. Yang
It appears the build is still broken. Sorry! Please stand by, or roll back the last set of commits. Edward Excerpts from Scott Lawrence's message of Sat Jun 11 12:44:18 -0400 2011: Trying to compile GHC7 from source (as the ubuntu repository is still on GHC6), I came across the following error

Re: [Haskell-cafe] How on Earth Do You Reason about Space?

2011-06-01 Thread Edward Z. Yang
That sounds like a plausible reason why naive copying explodes space. Something like string interning would be good here... and since you're hashing already... Edward Excerpts from Daniel Fischer's message of Wed Jun 01 06:46:24 -0400 2011: On Wednesday 01 June 2011 12:28:28, John Lato wrote:

Re: [Haskell-cafe] How on Earth Do You Reason about Space?

2011-05-31 Thread Edward Z. Yang
Hello Aleksandar, It is possible that the iteratees library is space leaking; I recall some recent discussion to this effect. Your example seems simple enough that you might recompile with a version of iteratees that has -auto-all enabled. Unfortunately, it's not really a safe bet to assume your

Re: [Haskell-cafe] Thoughts about currying and optimisations

2011-05-31 Thread Edward Z. Yang
I believe this transformation is called the 'full laziness' optimization. It can introduce space leaks if the computationally expensive test is replaced with a reference to a space expensive value. Edward Excerpts from Yves Parès's message of Tue May 31 15:14:07 -0400 2011: Hello Café, An idea

Re: testsuite results

2011-05-15 Thread Edward Z. Yang
To chime in, latest validate for me on x86-32 had two fails: OVERALL SUMMARY for test run started at Sun May 15 16:16:28 BST 2011 2773 total tests, which gave rise to 10058 test cases, of which 0 caused framework failures 7598 were skipped 2377 expected passes 81

Re: Tracing idea

2011-05-12 Thread Edward Z. Yang
:46:01 -0500 2011: On 21/02/2011 01:08, Edward Z. Yang wrote: Excerpts from Tyson Whitehead's message of Sun Feb 20 07:14:56 -0500 2011: I believe a back trace on the actual call stack is generally considered not that useful in a lazy language as it corresponds to the evaluation sequence

Re: [Haskell-cafe] runST readSTRef type error

2011-05-04 Thread Edward Z. Yang
Hello Ken, Strictly speaking, you only need Rank-2 types. This indeed the right way to fix the problem. Cheers, Edward Excerpts from Ken Takusagawa II's message of Wed May 04 02:00:49 -0400 2011: I run into the following type error: foo :: ST s (STRef s Int) - Int foo p = (runST (p =

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

2011-04-30 Thread Edward Z. Yang
Excerpts from Heinrich Apfelmus's message of Mon Apr 25 04:01:03 -0400 2011: The thing is that lazy evaluation is referentially transparent while I don't care about [(1,4),(2,2)] vs [(2,2),(1,4)] is not. Perhaps more precisely, laziness's memoization properties rely on the referential

Re: [Haskell-cafe] GHC optimizer consuming memory

2011-04-30 Thread Edward Z. Yang
Hello Mike, I cannot reproduce using GHC HEAD (though it seems to hang on GHC 7.0.3), so my guess is the bug has been fixed. cvs-ghc, any guesses which patch this might have been? Cheers, Edward Excerpts from mike frai's message of Sat Apr 30 14:50:17 -0400 2011: Hi, While using Michael

Re: [Haskell-cafe] How to make ghc 7 with llvm?

2011-04-29 Thread Edward Z. Yang
Others have answered your real question (I think) adequately, but if I'm pedantic and answer precisely what you ask: You can compile GHC with llvm by adding -fllvm to your build.mk file: GhcHcOpts += -fllvm Cheers, Edward Excerpts from Magicloud Magiclouds's message of Thu Apr 28 21:49:11

Re: performance issues in simple arithmetic code

2011-04-28 Thread Edward Z. Yang
Excerpts from Denys Rtveliashvili's message of Thu Apr 28 04:41:48 -0400 2011: Well.. I found some places in C-- compiler which are supposed to convert division and multiplication by 2^n into shifts. And I believe these work sometimes. However in this case I am a bit puzzled because even if

Re: Are FFI calls interruptible?

2011-04-24 Thread Edward Z. Yang
No, you have to use the 'interruptible' keyword. Cheers, Edward Excerpts from Bas van Dijk's message of Sat Apr 23 20:07:05 -0400 2011: Hello, Quick question: are safe/unsafe FFI calls interruptible? Thanks, Bas ___ Glasgow-haskell-users

Re: Are FFI calls interruptible?

2011-04-24 Thread Edward Z. Yang
Excerpts from Bas van Dijk's message of Sun Apr 24 12:23:19 -0400 2011: On 24 April 2011 10:26, Edward Z. Yang ezy...@mit.edu wrote: No, you have to use the 'interruptible' keyword. Good, I need them to be uninterruptible. So I guess I can apply uninterruptibleMask_ only to the 'acquire lock

Re: Are FFI calls interruptible?

2011-04-24 Thread Edward Z. Yang
Excerpts from Bas van Dijk's message of Sun Apr 24 16:10:46 -0400 2011: Well the whole block of code is under a mask_ so if FFI calls are not interruptible the queued up exceptions should not be fired. Ah, I didn't know that. I think it would be extremely surprising for users if FFI calls ever

[Haskell-cafe] More ideas for controlled mutation

2011-04-24 Thread Edward Z. Yang
Laziness can be viewed as a form of controlled mutation, where we overwrite a thunk with its actual value, thus only running the code once and reaping great time benefits. I've been toying around with some ideas where we do alternative forms of controlled mutation. One such idea has to do with

<    1   2   3   4   >