Re: How does GHC's testsuite work?

2017-10-30 Thread Edward Z. Yang
Excerpts from Sébastien Hinderer's message of 2017-10-30 16:39:24 +0100: > Dear Edward, > > Many thanks for your prompt response! > > Edward Z. Yang (2017/10/30 11:25 -0400): > > Actually, it's the reverse of what you said: like OCaml, GHC essentially > &

Re: How does GHC's testsuite work?

2017-10-30 Thread Edward Z. Yang
Actually, it's the reverse of what you said: like OCaml, GHC essentially has ~no unit tests; it's entirely Haskell programs which we compile (and sometimes run; a lot of tests are for the typechecker only so we don't bother running those.) The .T file is just a way of letting the Python driver kno

Re: How to get a heap visualization

2017-08-30 Thread Edward Z. Yang
Why not the plain old heap profiler? Edward Excerpts from Yitzchak Gale's message of 2017-08-30 18:34:05 +0300: > I need a simple heap visualization for debugging purposes. > I'm using GHC 8.0.2 to compile a large and complex yesod-based > web app. What's the quickest and easiest way? > > Vacuum

Re: Profiling plugins

2017-06-11 Thread Edward Z. Yang
Hello M, Unfortunately, if you want detailed profiling, you will have to rebuild GHC with profiling. Note that you can basic heap profile information without rebuilding GHC. Edward Excerpts from M Farkas-Dyck's message of 2017-06-06 12:34:57 -0800: > How is this done? I am working on ConCat > [

Re: Accessing the "original" names via GHC API

2017-01-25 Thread Edward Z. Yang
Hi Ranjit, Unfortunately you need more information to do this, since the set of modules which are available for import can vary depending on whether or not packages are hidden or not (not even counting whether or not a module is exposed or not!) The way GHC's pretty printer gives a good name is t

FINAL CALL FOR TALKS (Aug 8 deadline): Haskell Implementors Workshop 2016, Sep 24, Nara

2016-08-01 Thread Edward Z. Yang
Deadline is in a week! Submit your talks! Call for Contributions ACM SIGPLAN Haskell Implementors' Workshop http://haskell.org/haskellwiki/HaskellImplementorsWorkshop/2016 Nara, Japan, 24 September, 2016 Co-located w

Call for talks: Haskell Implementors Workshop 2016, Sep 24 (FIXED), Nara

2016-06-09 Thread Edward Z. Yang
man (FP Complete) * Luite Stegeman (ghcjs) * Niki Vazou (UCSD) * Stephanie Weirich (University of Pennsylvania) * Edward Z. Yang - chair (Stanford University) ___ Glasgow-haskell-users mailing list Gla

Call for talks: Haskell Implementors Workshop 2016, Aug 24, Nara

2016-06-09 Thread Edward Z. Yang
) * Niki Vazou (UCSD) * Stephanie Weirich (University of Pennsylvania) * Edward Z. Yang - chair (Stanford University) ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users

Re: idea: tool to suggest adding imports

2016-03-18 Thread Edward Z. Yang
Hello John, In my opinion, the big question is whether or not your Emacs extension should know how to build your Haskell project. Without this knowledge, (1) and (3) are non-starters, since you have to pass the right set of -package flags to GHC to get the process started. If you do assume you h

Re: Discovery of source dependencies without --make

2015-12-13 Thread Edward Z. Yang
I missed context, but if you just want the topological graph, depanal will give you a module graph which you can then topsort with topSortModuleGraph (all in GhcMake). Then you can do what you want with the result. You will obviously need accurate targets but frontend plugins and guessTarget will

Re: type error formatting

2015-10-23 Thread Edward Z. Yang
I think this is quite a reasonable suggestion. Edward Excerpts from Evan Laforge's message of 2015-10-23 19:48:07 -0700: > Here's a typical simple type error from GHC: > > Derive/Call/India/Pakhawaj.hs:142:62: > Couldn't match type ‘Text’ with ‘(a1, Syllable)’ > Expected type: [([(a1, Sy

Re: [Haskell-cafe] The evil GADTs extension in ghci 7.8.4 (maybe in other versions too?)

2015-06-04 Thread Edward Z. Yang
; strange. Wouldn't it be better to decouple GADT and MonoLocalBinds? > > 2015년 06월 04일 20:31에 Edward Z. Yang 이(가) 쓴 글: > > This is because -XGADTs implies -XMonoLocalBinds. > > > > Edward > > > > Excerpts from Ki Yung Ahn's message of 2015-06-04 2

Re: [Haskell-cafe] The evil GADTs extension in ghci 7.8.4 (maybe in other versions too?)

2015-06-04 Thread Edward Z. Yang
This is because -XGADTs implies -XMonoLocalBinds. Edward Excerpts from Ki Yung Ahn's message of 2015-06-04 20:29:50 -0700: > \y -> let x = (\z -> y) in x x > > is a perfectly fine there whose type is a -> a. > (1) With no options, ghci infers its type correctly. > (2) However, with -XGADTs, typ

Re: SRC_HC_OPTS in perf build

2015-05-26 Thread Edward Z. Yang
Sounds like an oversight to me! Submit a fix? Excerpts from Jeremy's message of 2015-05-25 06:44:10 -0700: > build.mk.sample contains the lines: > > # perf matches the default settings, repeated here for comparison: > SRC_HC_OPTS = -O -H64m > > However, in config.mk.in this is: > > SRC_HC_

Re: runghc and GhcWithInterpreter

2015-04-06 Thread Edward Z. Yang
No, it's not supposed to work, since runghc interprets GHC code. runghc itself is just a little shell script which calls GHC proper with the -f flag, so I suppose the build system was just not set up to not create this link in that case. Edward Excerpts from Jeremy's message of 2015-04-06 07:34:3

Re: Binary bloat in 7.10

2015-04-01 Thread Edward Z. Yang
Yes, this does seem like a potential culprit, although we did do some measurements and I didn't think it was too bad. Maybe we were wrong! Edward Excerpts from Jeremy's message of 2015-04-01 07:26:55 -0700: > Carter Schonwald wrote > > How much of this might be attributable to longer linker symbo

Re: GHC 7.10 regression when using foldr

2015-01-20 Thread Edward Z. Yang
. On the down-side, the results of > -ddump-minimal-imports would be er.. less minimal. > > On Tue, Jan 20, 2015 at 6:47 PM, Edward Z. Yang wrote: > > > I like this proposal: if you're explicit about an import that > > would otherwise be implicit by Prelude, you shouldn&

Re: GHC 7.10 regression when using foldr

2015-01-20 Thread Edward Z. Yang
h 7.10 and > with HEAD, it might be worth trying out such a change to see how much it > reduces the warning volume and if it somehow manages to introduce any new > warnings. > > I hesitate to make such a proposal this late in the release candidate game, > but if it worked it&#

Re: GHC 7.10 regression when using foldr

2015-01-20 Thread Edward Z. Yang
Hello Edward, Shouldn't we publicize this trick? Perhaps in the changelog? Edward Excerpts from Edward Kmett's message of 2015-01-20 15:22:57 -0800: > Building -Wall clean across this change-over has a big of a trick to it. > > The easiest way I know of when folks already had lots of > > impor

Re: "Found hole"

2015-01-20 Thread Edward Z. Yang
Hello Volker, All identifiers prefixed with an underscore are "typed holes", see: https://downloads.haskell.org/~ghc/7.8.3/docs/html/users_guide/typed-holes.html Edward Excerpts from Volker Wysk's message of 2015-01-20 10:36:09 -0800: > Hello! > > What is a "hole"? > > This program fails to c

Re: Compiling a cabal project with LLVM on GHC 7.10 RC1

2015-01-07 Thread Edward Z. Yang
...is there -dynamic in the -v output? Don't you also want --disable-shared? Excerpts from Brandon Simmons's message of 2015-01-07 12:21:48 -0800: > I've tried: > > $ cabal install --only-dependencies -w > /usr/local/bin/ghc-7.10.0.20141222 --enable-tests --enable-benchmarks > --ghc-option=-f

Re: GHC 7.4.2 on Ubuntu Trusty

2015-01-04 Thread Edward Z. Yang
ernative into the GHC sources. Edward Excerpts from Herbert Valerio Riedel's message of 2015-01-04 00:22:28 -0800: > Hello Edward, > > On 2015-01-04 at 08:54:58 +0100, Edward Z. Yang wrote: > > [...] > > > There are also some changes to hoopl, transformers and hpc

Re: GHC 7.4.2 on Ubuntu Trusty

2015-01-03 Thread Edward Z. Yang
to the download > site > > Thanks, > Yitz > > On Wed, Oct 29, 2014 at 12:10 AM, Edward Z. Yang wrote: > > Excerpts from Yitzchak Gale's message of 2014-10-28 13:58:08 -0700: > >> How about this: Currently, every GHC source distribution > >> requires no

Re: ANNOUNCE: GHC 7.10.1 Release Candidate 1 - problem with latest cabal-install

2015-01-01 Thread Edward Z. Yang
tion index > /Users/gcolpitts/Library/Haskell/share/doc/index.html > > On Thu, Jan 1, 2015 at 2:54 PM, Edward Z. Yang wrote: > > > If you still have your old GHC around, it will be much better to > > compile the newest cabal-install using the *old GHC*, and then > > us

Re: ANNOUNCE: GHC 7.10.1 Release Candidate 1 - problem with latest cabal-install

2015-01-01 Thread Edward Z. Yang
If you still have your old GHC around, it will be much better to compile the newest cabal-install using the *old GHC*, and then use that copy to bootstrap a copy of the newest cabal-install. Edward Excerpts from George Colpitts's message of 2015-01-01 12:08:44 -0500: > ​$ ​ > cabal update > Downl

Re: ANNOUNCE: GHC 7.10.1 Release Candidate 1

2014-12-27 Thread Edward Z. Yang
Hello lonetiger, I don't think any relevant logic changed in 7.10; however, this commit may be relevant: commit 8fb03bfd768ea0d5c666bbe07a50cb05214bbe92 Author: Ian Lynagh Sun Mar 18 11:42:31 2012 Committer: Ian Lynagh Sun Mar 18 11:42:31 2012 Original File: compiler

Re: Thread behavior in 7.8.3

2014-10-29 Thread Edward Z. Yang
ield, just not until after the timeout. > > Is that understanding correct? > > (technically, doesn't it change to yielding after stack checks or something > like that?) > > On Thu, Oct 30, 2014 at 8:24 AM, Edward Z. Yang wrote: > > > I don't think this is di

Re: Thread behavior in 7.8.3

2014-10-29 Thread Edward Z. Yang
I don't think this is directly related to the problem, but if you have a thread that isn't yielding, you can force it to yield by using -fno-omit-yields on your code. It won't help if the non-yielding code is in a library, and it won't help if the problem was that you just weren't setting timeouts

Re: GHC 7.4.2 on Ubuntu Trusty

2014-10-28 Thread Edward Z. Yang
Excerpts from Yitzchak Gale's message of 2014-10-28 13:58:08 -0700: > How about this: Currently, every GHC source distribution > requires no later than its own version of GHC for bootstrapping. > Going backwards, that chops up the sequence of GHC versions > into tiny incompatible pieces - there is

Re: optimizing StgPtr allocate (Capability *cap, W_ n)

2014-10-16 Thread Edward Z. Yang
Hi Bulat, This seems quite reasonable to me. Have you eyeballed the assembly GCC produces to see that the hotpath is improved? If you can submit a patch that would be great! Cheers, Edward Excerpts from Bulat Ziganshin's message of 2014-10-14 10:08:59 -0700: > Hello Glasgow-haskell-users, > > i

Re: hmatrix

2014-08-24 Thread Edward Z . Yang
Hello Adrian, This sounds like a definite bug in Cabal, in that it should report accordingly if it is looking for both static and dynamic versions of the library, and only finds the static one. Can you file a bug report? Thanks, Edward Excerpts from Adrian Victor Crisciu's message of 2014-08-23

Re: hmatrix-0.16.0.4 installation problem

2014-08-22 Thread Edward Z . Yang
Excerpts from Adrian Victor Crisciu's message of 2014-08-22 10:55:00 +0100: > I tried the following command line: > > cabal install --enable-documentation > --extra-include-dirs=/usr;local/include --extra-lib-dirs=/usr/local/lib > hmatrix Is that semicolon a typo? Edward

Re: hmatrix-0.16.0.4 installation problem

2014-08-21 Thread Edward Z . Yang
Hello Adrian, Are the header files for blas and lapack on your system? (I'm not sure what the configure script for other software was checking for.) Edward Excerpts from Adrian Victor Crisciu's message of 2014-08-21 14:22:58 +0100: > Sorry! > > This is the the failed cabal install command and i

Re: 'import ccall unsafe' and parallelism

2014-08-14 Thread Edward Z . Yang
I have to agree with Brandon's diagnosis: unsafePerformIO will take out a lock, which is likely why you are seeing no parallelism. Edward Excerpts from Brandon Allbery's message of 2014-08-14 17:12:00 +0100: > On Thu, Aug 14, 2014 at 11:54 AM, Christian Höner zu Siederdissen < > choe...@tbi.univi

Re: cabal repl failing silently on missing exposed-modules

2014-08-08 Thread Edward Z . Yang
If you haven't already, go file a bug on https://github.com/haskell/cabal/issues Edward Excerpts from cheater00 .'s message of 2014-08-06 15:18:04 +0100: > Hi, > I have just spent some time trying to figure out why all of a sudden > "cabal repl" silently exits without an error message. What helpe

Re: Failure compiling ghc-mtl with ghc-7.8.{2,3}

2014-07-20 Thread Edward Z . Yang
: > I think I found the problem. > > package ghc-7.8.3 requires transformers-0.3.0.0 > package mtl-2.2.1 requires transformers-0.4.1.0 > package exceptions-0.6.1 requires transformers-0.4.1.0 > > I wonder how is this ever supposed to work :( > > On Sun, Jul 20, 2014 a

Re: Failure compiling ghc-mtl with ghc-7.8.{2,3}

2014-07-20 Thread Edward Z . Yang
The last time I saw this error, it was because the package database was messed up (there was an instance of MonadIO in scope, but it was for the wrong package.) However, I don't know what the source of the problem is here. Edward Excerpts from i hamsa's message of 2014-07-20 08:26:52 +0100: > I

Re: Using mutable array after an unsafeFreezeArray, and GC details

2014-05-12 Thread Edward Z . Yang
Excerpts from Brandon Simmons's message of 2014-05-10 13:57:40 -0700: > Another silly question: when card-marking happens after a write or > CAS, does that indicate "this segment maybe contains old-to-new > generation references, so be sure to preserve (scavenge?) them from > collection "? In my in

Re: Using mutable array after an unsafeFreezeArray, and GC details

2014-05-09 Thread Edward Z . Yang
Excerpts from Carter Schonwald's message of 2014-05-09 16:49:07 -0700: > Any chance you could try to use storable or unboxed vectors? Neither of those will work if, at the end of the day, you need to store pointers to heap objects Edward ___ Glasgow-has

Re: Using mutable array after an unsafeFreezeArray, and GC details

2014-05-09 Thread Edward Z . Yang
Hello Brandon, Excerpts from Brandon Simmons's message of 2014-05-08 16:18:48 -0700: > I have an unusual application with some unusual performance problems > and I'm trying to understand how I might use unsafeFreezeArray to help > me, as well as understand in detail what's going on with boxed muta

Re: memory ordering

2013-12-31 Thread Edward Z . Yang
> Second, the optimizer is a bit more conservative when it comes to > primop calls (internally referred to as "unsafe foreign calls") Sorry, I need to correct myself here. Foreign primops, and most out-of-line primops, compile into jumps which end basic blocks, which constitute hard boundaries si

Re: memory ordering

2013-12-31 Thread Edward Z . Yang
> atomic-primops package. From the docs, I think that's a general read > barrier, and should do what I want. Assuming it works properly, of course. > If I'm lucky it might even be optimized out. > > Thanks, > John > > On Mon, Dec 30, 2013 at 6:04 AM, Edward Z. Y

Re: memory ordering

2013-12-30 Thread Edward Z . Yang
Hello John, Here are some prior discussions (which I will attempt to summarize below): http://www.haskell.org/pipermail/haskell-cafe/2011-May/091878.html http://www.haskell.org/pipermail/haskell-prime/2006-April/001237.html http://www.haskell.org/pipermail/haskell-prime/2006-March/001

Re: blocking parallel program

2013-10-19 Thread Edward Z. Yang
Unfortunately, it doesn't seem to help. > > Facundo > > On Sat, Oct 19, 2013 at 8:47 PM, Edward Z. Yang wrote: > > Hello Facundo, > > > > The reason is that you have compiled the program to be multithreaded, but it > > is not running with multiple cores. C

Re: Trying to compile ghc HEAD on xubuntu 13.04-x64

2013-10-04 Thread Edward Z. Yang
As a workaround, add this to your mk/build.mk HADDOCK_DOCS = NO BUILD_DOCBOOK_HTML = NO BUILD_DOCBOOK_PS = NO BUILD_DOCBOOK_PDF = NO This is a bug. Edward Excerpts from Nathan Hüsken's message of Fri Oct 04 13:55:01 -0700 2013: > Hey, > > because I have touble with ghci and packages w

Re: 7.8 Release Update

2013-09-14 Thread Edward Z. Yang
> Edward > > Excerpts from Johan Tibell's message of Mon Sep 09 16:15:45 -0700 2013: > > That sounds terrible expensive to do on every `cabal build` and its a > > cost most users won't understand (what was broken before?). > > > > On Mon, Sep 9, 2013 at 4

Re: 7.8 Release Update

2013-09-09 Thread Edward Z. Yang
ken before?). > > On Mon, Sep 9, 2013 at 4:06 PM, Edward Z. Yang wrote: > > If I am building some Haskell executable using 'cabal build', the > > result should be *statically linked* by default. > > > > However, subtly, if I am building a Haskell library,

Re: 7.8 Release Update

2013-09-09 Thread Edward Z. Yang
If I am building some Haskell executable using 'cabal build', the result should be *statically linked* by default. However, subtly, if I am building a Haskell library, I would like to be able to load the compiled version into GHCi. So it seems to me cabal should produce v, dyn (libs only, not fin

Re: 7.8 Release Update

2013-09-09 Thread Edward Z. Yang
Hello Mikhail, It is a known issue that Template Haskell does not work with profiling (because GHCi and profiling do not work together, and TH uses GHCi's linker). [1] Actually, with the new linker patches that are landing soon we are not too far off from having this work. Edward [1] http://ghc

Re: 7.8 Release Update

2013-09-09 Thread Edward Z. Yang
> I think Kazu is saying that when he builds something with profiling > using cabal-install, it fails because cabal-install tries to build a > dynamic version too. We don't want dyanmic/profiled libraries (there's > no point, you can't load them into GHCi). Perhaps this is something > that ne

Re: 7.8 Release Update

2013-09-09 Thread Edward Z. Yang
Excerpts from Kazu Yamamoto (山本和彦)'s message of Sun Sep 08 19:36:19 -0700 2013: > > % make show VALUE=GhcLibWays > make -r --no-print-directory -f ghc.mk show > GhcLibWays="v p dyn" > Yes, it looks like you are missing p_dyn from this list. I think this is a bug in the build system. Whe

Re: GHC and GSL

2013-07-22 Thread Edward Z. Yang
Usually, a bus error is similar to a segmentation fault, in that it indicates something has gone terribly wrong. However, as hmatrix is an API to some foreign C libraries, I would not rule out the possibility that it's a bug in the library itself. What version of hmatrix do you have, and if you c

Re: executable stack flag

2013-07-09 Thread Edward Z. Yang
I've gone ahead and fixed it, and referenced the patches in the ticket. Cheers, Edward Excerpts from Jens Petersen's message of Mon Jul 08 21:36:42 -0700 2013: > Hi, > > We noticed [1] in Fedora that ghc (7.4 and 7.6) are linking executables > (again [2]) with the executable stack flag set. I ha

Re: executable stack flag

2013-07-08 Thread Edward Z. Yang
I took a look at the logs and none mentioned 'Hey, so it turns out we need executable stack for this', and as recently as Sep 17, 2011 there are patches for turning off executable stack (courtesy Gentoo). So probably it is just a regression, someone added some code which didn't turn off executabl

Re: Why is GHC so much worse than JHC when computing the Ackermann function?

2013-04-20 Thread Edward Z. Yang
I don't seem to get the leak on latest GHC head. Running the program in GC debug mode in 7.6.2 is quite telling; the program is allocating *a lot* of megablocks. We probably fixed it though? Edward Excerpts from Mikhail Glushenkov's message of Sat Apr 20 01:55:10 -0700 2013: > Hi all, > > This

Re: mask, catch, myThreadId, throwTo

2013-04-16 Thread Edward Z. Yang
OK, I've updated the docus. Excerpts from Felipe Almeida Lessa's message of Mon Apr 15 13:34:50 -0700 2013: > Thanks a lot, you're correct! The trouble is, I was misguided by the > "Interruptible operations" note [1] which states that > > The following operations are guaranteed not to be int

Re: mask, catch, myThreadId, throwTo

2013-04-15 Thread Edward Z. Yang
Sounds like those docs need to be fixed, in that case. Edward Excerpts from Felipe Almeida Lessa's message of Mon Apr 15 13:34:50 -0700 2013: > Thanks a lot, you're correct! The trouble is, I was misguided by the > "Interruptible operations" note [1] which states that > > The following oper

Re: Foreign.StablePtr: nullPtr & double-free questions.

2013-03-13 Thread Edward Z. Yang
Excerpts from Remi Turk's message of Wed Mar 13 13:09:18 -0700 2013: > Thanks for your quick reply. Could you elaborate on what "a bit of > overhead" means? > As a bit of context, I'm working on a small library for working with > (im)mutable extendable > tuples/records based on Storable and Foreign

RE: runghc -fdefer-type-errors

2013-03-11 Thread Edward Z. Yang
Excerpts from Simon Peyton-Jones's message of Mon Mar 11 16:04:31 -0700 2013: > Aha. It is indeed true that > > ghc -fdefer-type-errors -w > > does not suppress the warnings that arise from the type errors; indeed there > is no current way to do so. How to do that? > > To be kosher there

Re: Foreign.StablePtr: nullPtr & double-free questions.

2013-03-08 Thread Edward Z. Yang
Excerpts from Remi Turk's message of Fri Mar 08 18:28:56 -0800 2013: > Good night everyone, > > I have two questions with regards to some details of the > Foreign.StablePtr module. [1] > > 1) The documentation suggests, but does not explicitly state, that > castStablePtrToPtr `liftM` newStableP

Re: Cloud Haskell and network latency issues with -threaded

2013-02-07 Thread Edward Z. Yang
usage worse. You can see my patch here: > https://github.com/AndreasVoellmy/ghc-arv/commits/push-work-exchange-squashed > . > > -Andi > > On Fri, Feb 8, 2013 at 12:10 AM, Edward Z. Yang wrote: > > > Hey folks, > > > > The latency changes sound relevant

RE: Cloud Haskell and network latency issues with -threaded

2013-02-07 Thread Edward Z. Yang
Hey folks, The latency changes sound relevant to some work on the scheduler I'm doing; is there a place I can see the changes? Thanks, Edward Excerpts from Simon Peyton-Jones's message of Wed Feb 06 10:10:10 -0800 2013: > I (with help from Kazu and helpful comments from Bryan and Johan) have nea

Re: What is the scheduler type of GHC?

2013-01-16 Thread Edward Z. Yang
Excerpts from Magicloud Magiclouds's message of Wed Jan 16 00:32:00 -0800 2013: > Hi, > Just read a post about schedulers in erlang and go lang, which informed > me that erlang is preemptive and go lang is cooperative. > So which is used by GHC? From ghc wiki about rts, if the question is only

Re: Hoopl vs LLVM?

2012-12-10 Thread Edward Z. Yang
Hello Greg, Hoopl passes live in compiler/cmm; searching for DataflowLattice will turn up lattice definitions which are the core of the analyses and rewrites. Unfortunately, the number of true Hoopl optimizations was somewhat reduced when Simon Marlow did aggressive performance optimizations to ge

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 P

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 clea

Re: [GHC Users] Dictionary sharing

2012-06-29 Thread Edward Z. Yang
class C a where > memoised :: Int -> a > <<< > > Perhaps functions are treated differently? > > Regards, > Jonas > > On 29 June 2012 15:55, Edward Z. Yang wrote: > > Hello Jonas, > > > > Like other top-level definitions, these instances are

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 = uns

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'

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

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, Her

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
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. > >

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
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 wr

Re: ghc needs memory

2012-01-27 Thread Edward Z. Yang
Hello John, When this has happened to me in the past, it was because I was trying to allocate using a corrupted read (though, this was a userland). So it's very plausible you've hit a bug in GHC. Have you tried 7.2? HEAD? Edward Excerpts from John Meacham's message of Fri Jan 27 19:33:13 -0500

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

2012-01-24 Thread Edward Z. Yang
Excerpts from Ryan Newton's message of Tue Jan 24 10:25:37 -0500 2012: > This is related but somewhat tangential -- > > *Why isn't there a tryReadChan?* It looks like it would be implementable > with the current Chan representation in terms of tryTakeMVar. Especially > since isEmptyChan is dep

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

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 $

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 sen

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 inlinin

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 so

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 issu

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 assessmen

What makes GHC's GC good for purely functional workloads?

2011-11-22 Thread Edward Z. Yang
Apologies if this has been asked before. In some ways GHC's garbage collectors are very traditional, so I was wondering what magic dust makes it do better in Haskelly workloads (e.g. whereas you'd need to do a bit more work in the JVM to make some allocation pattern play nice.) Edward __

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: 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 wrote: >

Re: Cheap and cheerful partial evaluation

2011-08-23 Thread Edward Z. Yang
n), and could use cp0 to preprocess the source and > then print it back out. > > On Mon, Aug 22, 2011 at 8:48 AM, Edward Z. Yang wrote: > > > I think this ticket sums it up very nicely! > > > > Cheers, > > Edward > > > > Excerpts from Max Bolingbrok

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 wrote: > > And no sooner do I send this email do I realize we have 'inline' built-in, > >

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: 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 > opt

Cheap and cheerful partial evaluation

2011-08-21 Thread Edward Z. Yang
Hello all, It occurred to me that it might not be too difficult to use GHC's optimization passes as a cheap and cheerful partial evaluator. Consider some function we would like to partially evaluate: f = g h Partial evaluation proceeds as follows: calculate the type of f, inline and special

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 fl

Re: hsc2hs and #include

2011-07-30 Thread Edward Z. Yang
1: > On Sat, Jul 30, 2011 at 8:32 PM, Edward Z. Yang 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

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: 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 is

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

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

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)

  1   2   >