Oh, thanks! I wasn't aware of either or these! Useful to know. 

That does cover the use case I could think of. 

Thanks, 
Tamar 

On Mon, Oct 10, 2016, 14:34 Ben Gamari <ben@well-typed.com> wrote:
Phyx <lonetiger@gmail.com> writes:

> Oops, sorry, only just now seen this. It seems my overly aggressive filters
> couldn't decide where to put the email :)
>
> I do agree to some extend with this. I'd prefer if I made a mistake for my
> system not to hang. The one downside to this default though is that you
> can't just hand a program over to user and have it run at full capabilities.
>
> If it possible to set this from inside a program? My guess is no, since by
> the time you get to main the rts is already initialized?
>
> Would a useful alternative be to provide a compile flag that would change
> the default? e.g. opt-in? Since now there is a small burden on the end user.
>
There exist two pretty good tools for accomplishing what you want,

 1. Call Control.Concurrent.setNumCapabilities [1] from within your
    application.

 2. Use GHC's -with-rtsopts flag [2] to set the default RTS arguments
    during compilation of your application.

Cheers,

- Ben


[1] http://localhost:7000/file/opt/exp/ghc/roots/8.0.1/share/doc/ghc-8.0.1/html/libraries/base-4.9.0.0/Control-Concurrent.html#v:setNumCapabilities
[2] http://downloads.haskell.org/~ghc/master/users-guide//phases.html?highlight=#ghc-flag--with-rtsopts