Jason Dagit | 1 Dec 01:59 2010

Re: Conditional compilation for different versions of GHC?



On Sat, Nov 27, 2010 at 9:59 AM, Jinjing Wang <nfjinjing <at> gmail.com> wrote:
Thanks Michael,

So the user should use `cabal install --flags -ghc7 package-name` to
install the package, if I'm not mistaken?

Will it work if the package is installed as a dependency? Will the
flag environment be passed down from the root package?

Is there a way to detect GHC version automatically?

I see that others have provided answers on here, but another way is to change the check from:

   if flag(ghc7)
       build-depends:   base                      >= 4.3      && < 5
       cpp-options:     -DGHC7
   else
       build-depends:   base                      >= 4        && < 4.3

to this:
   if impl(ghc >= 7)
       build-depends:   base                      >= 4.3      && < 5
       cpp-options:     -DGHC7
   else
       build-depends:   base                      >= 4        && < 4.3

I hope that helps,
Jason
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
Jason | 1 Dec 02:29 2010
Picon

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

On Tue, Nov 30, 2010 at 02:16:07PM -0800, Adam Wick wrote:
> Galois, Inc. is pleased to announce the immediate release of the
> Haskell Lightweight Virtual Machine (or HaLVM), version 1.0. The
> HaLVM is a port of the GHC runtime system to the Xen hypervisor,
> allowing programmers to create Haskell programs that run directly on
> Xen's "bare metal." Internally, Galois has used this system in
> several projects with much success, and we hope y'all will have an
> equally great time with it.
>
> What might you do with a HaLVM? Pretty much anything you want. :)
> Explore designs for operating system decomposition, examine new
> notions of mobile computation with the HaLVM and Xen migration, or
> find interesting network services and lock them inside small, cheap,
> single-purpose VMs.

I had seen a paper which implemented something like this with OCaml. And what do you know? Here's a running, open-source, available-now version in Haskell. 

Congrats to Galois for open sourcing this. Now let the collaboration begin.

Would it be possible to run HaLVM on Amazon EC2?
-- 
Jason M. Knight
Ph.D. Electrical Engineering '13
Texas A&M University
Cell: 512-814-8101
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
Sterling Clover | 1 Dec 02:56 2010
Picon

Re: GHC 7.0.1 developer challenges

On Tue, Nov 30, 2010 at 9:24 AM, Ryan Ingram <ryani.spam <at> gmail.com> wrote:
> On Mon, Nov 29, 2010 at 12:36 AM, Simon Peyton-Jones
> <simonpj <at> microsoft.com> wrote:
>> Do you have an alternative to suggest?  After all, the previous situation wasn't good either.
>
> I suggest that we should be able to specify RTS options at
> compile/link time, or as pragmas in the Main module.
>
>  -- ryan

What's feasible to write now, and almost better (but lacking
toolchain/library support) is writing two executables. The first takes
command line options, decides what to do based on them, and then
passes control to the second, with flags set only as appropriate.
Doing this cleanly is OS dependent, and tied to System.Process,
daemonizing-type techniques, and all that. Such a library, possibly
implemented as a nontrivial extension (or borrowing code from) the
excellent-looking hdaemonize package, would be very welcome!

Cheers,
Sterl.
Thomas Schilling | 1 Dec 03:07 2010

Re: Conditional compilation for different versions of GHC?

I think a nicer way to solve that issue is to use Cabal's MIN_VERSION macros.

 1. Add CPP to your extensions.  This will cause cabal to
auto-generate a file with MIN_VERSION_≤pkg> macros for each <pkg> in
build-depends.

 2. GHC 6.12.* comes with template-haskell 2.4, so to test for that use:

#ifdef MIN_VERSION_template_haskell(2,4,0)
  .. ghc-6.12.* code here.
#endif

This should make it more transparent to the user.

On 27 November 2010 16:59, Jinjing Wang <nfjinjing <at> gmail.com> wrote:
> Dear list,
>
> >From ghc 7.0.1 release notes:
>
>> The Language.Haskell.TH.Quote.QuasiQuoter type has two new fields: quoteType and quoteDec.
>
> Some of my code needs to be conditionally compiled to support both
> version 6 and 7, what is the recommended way to do it?
>
> ref:
>
> * http://new-www.haskell.org/ghc/docs/7.0.1/html/users_guide/release-7-0-1.html
>
> --
> jinjing
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe <at> haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>

--

-- 
Push the envelope. Watch it bend.
Mitar | 1 Dec 03:18 2010
Picon

[ANNOUNCE] A general data-flow framework

Hi!

I have just published my library which provides a general data-flow framework:

http://hackage.haskell.org/package/Etage

Sadly it requires current GHC HEAD branch because of this:

http://hackage.haskell.org/trac/ghc/ticket/1769

Short description:

A general data-flow framework featuring nondeterminism, laziness and
neurological pseudo-terminology. It can be used for example for
data-flow computations or event propagation networks. It tries hard to
aide type checking and to allow proper initialization and cleanup so
that interfaces to input and output devices (data or events producers
or consumers) can be made (so that created models/systems/networks can
be used directly in real world applications, for example robots).

I am more than open to any suggestions and comments.

Mitar
Mitar | 1 Dec 04:02 2010
Picon

Re: [Haskell-cafe] Printing of asynchronous exceptions to stderr

Hi!

On Thu, Nov 18, 2010 at 2:19 PM, Simon Marlow <marlowsd <at> gmail.com> wrote:
> then it isn't uninterruptible, because the timeout can interrupt it.  If you
> can tolerate a timeout exception, then you can tolerate other kinds of async
> exception too.

Yes, but semantics are different. I want to tolerate some exception
because they are saying I should do this and this (for example user
interrupt, or timeout) but I do not want others, which somebody else
maybe created and I do not want to care about them.

> My main question is then, why do you want to use maskUninterruptible rather
> than just mask?  Can you give a concrete example?

I have written few of them. As I said: timeout and user exceptions.
Timeout is for interrupts with which me as a programmer want to limit
otherwise uninterruptible code, and user exceptions so that users can
limit otherwise uninterruptible code.

But in meanwhile I have find an elegant way to solve my problems (very
old one in fact). ;-)

I have defined such function:

uninterruptible :: IO a -> IO a
uninterruptible a = mask_ $ a `catch` (\(_ :: SomeException) ->
uninterruptible a)

with which I wrap takeMVar and other interruptible operations. As they
can only be interrupted or succeed they can simply be retried until
they succeed. In this way my code is not susceptible to possible dead
locks which could happen if I would use maskUninterruptible and for
example throw two exceptions between two threads, while they would
both be in maskUninterruptible section. In this way I can remain in
only masked state, exceptions can still be delivered, but my program
flow is not interrupted. Of course function about can be also easily
modified to allow user interrupts and timeouts, but not other
exceptions. And as I want to use this code only in my cleanup code I
do not really care about new exceptions being ignored.

Mitar

_______________________________________________
Glasgow-haskell-users mailing list
Glasgow-haskell-users <at> haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Michael Snoyman | 1 Dec 04:54 2010

Re: Conditional compilation for different versions of GHC?

On Wed, Dec 1, 2010 at 4:07 AM, Thomas Schilling
<nominolo <at> googlemail.com> wrote:
> I think a nicer way to solve that issue is to use Cabal's MIN_VERSION macros.
>
>  1. Add CPP to your extensions.  This will cause cabal to
> auto-generate a file with MIN_VERSION_≤pkg> macros for each <pkg> in
> build-depends.
>
>  2. GHC 6.12.* comes with template-haskell 2.4, so to test for that use:
>
> #ifdef MIN_VERSION_template_haskell(2,4,0)
>  .. ghc-6.12.* code here.
> #endif
>
> This should make it more transparent to the user.

This is obviously a personal preference issue, but I try to avoid the
Cabal macros since they don't let my code run outside the context of
Cabal. I often times like to have a test suite that I can just use
with runhaskell, and (unless you can tell me otherwise) I can't run it
anymore.

Also, I think

#if GHC7
...
#endif

is more transparent than a check on template-haskell.

Michael
Eugene Kirpichov | 1 Dec 08:49 2010
Picon

Most images broken on haskellwiki pages

Hello.

I looked at a couple pages of mine
http://www.haskell.org/haskellwiki/Splot ,
http://www.haskell.org/haskellwiki/Timeplot , and at a couple of
random pages http://haskell.org/haskellwiki/Special:Random - and looks
like the vast majority of images are not displaying.

What's wrong? Does it have to do with the wiki redesign? What should,
say, I personally do about my images regarding this?

--

-- 
Eugene Kirpichov
Senior Software Engineer,
Grid Dynamics http://www.griddynamics.com/
Yitzchak Gale | 1 Dec 09:53 2010

Re: Most images broken on haskellwiki pages

Eugene Kirpichov wrote:
> I looked at a couple pages of mine...
> and looks
> like the vast majority of images are not displaying.

This probably has to do with moving the wiki to the
new server during the past few days. I forwarded your
email to the admin team there for them to have a look.

Regards,
Yitz
Simon Marlow | 1 Dec 10:50 2010
Picon

Re: [Haskell-cafe] Printing of asynchronous exceptions to stderr

On 01/12/2010 03:02, Mitar wrote:
> Hi!
>
> On Thu, Nov 18, 2010 at 2:19 PM, Simon Marlow<marlowsd <at> gmail.com>  wrote:
>> then it isn't uninterruptible, because the timeout can interrupt it.  If you
>> can tolerate a timeout exception, then you can tolerate other kinds of async
>> exception too.
>
> Yes, but semantics are different. I want to tolerate some exception
> because they are saying I should do this and this (for example user
> interrupt, or timeout) but I do not want others, which somebody else
> maybe created and I do not want to care about them.

Surely if you don't care about these other exceptions, then the right 
thing to do is just to propagate them?  Why can't they be dealt with in 
the same way as user interrupt?

>> My main question is then, why do you want to use maskUninterruptible rather
>> than just mask?  Can you give a concrete example?
>
> I have written few of them. As I said: timeout and user exceptions.
> Timeout is for interrupts with which me as a programmer want to limit
> otherwise uninterruptible code, and user exceptions so that users can
> limit otherwise uninterruptible code.
>
> But in meanwhile I have find an elegant way to solve my problems (very
> old one in fact). ;-)
>
> I have defined such function:
>
> uninterruptible :: IO a ->  IO a
> uninterruptible a = *CENSORED*

That is a very scary function indeed.  It just discards all exceptions 
and re-starts the operation.  I definitely do not condone its use.

Cheers,
	Simon

Gmane