[Haskell-cafe] A first glimps on the {-# NOUPDATE #-} pragma

Facundo Domínguez facundominguez at gmail.com
Wed Aug 29 15:26:55 CEST 2012


Hi,

>         upd_noupd n =
>             let l = myenum' 0 n
>             in last l + length l

This could be rewritten as

>         upd_noupd n =
>             let l n = myenum' 0 n
>             in last (l n) + length (l n)

Or a special form of let could be introduced to define locally-scoped macros:

>         upd_noupd n =
>             let# l = myenum' 0 n
>             in last l + length l

What's the strength of the {-# NOUPDATE #-} approach?

Regards,
Facundo


> Date: Wed, 29 Aug 2012 10:20:21 +0200
> From: Joachim Breitner <breitner at kit.edu>
> Subject: Re: [Haskell-cafe] A first glimps on the {-# NOUPDATE #-}
>         pragma
> To: haskell-cafe at haskell.org
> Message-ID: <1346228421.4271.9.camel at kirk>
> Content-Type: text/plain; charset="iso-8859-15"
>
> Hi,
>
> Am Dienstag, den 28.08.2012, 18:16 -0400 schrieb Carter Schonwald:
>> On Tuesday, August 28, 2012, Yves Par?s wrote:
>>         Monad? Simple strictness anotation is enough in that case:
>>
>>                 upd_noupd n =
>>                     let l = myenum' 0 n
>>                         h = head l
>>                     in h `seq` last l + h
>
> darn, I though I changed my examples before posting to:
>
>         upd_noupd n =
>             let l = myenum' 0 n
>             in last l + length l
>
> ("head" was a bad example because actually due to strictness analysis
> and worker/wrapper transformation, GHC would yield good code even
> without "`seq`").
>
> In this case (which is actually the benchmarked case), reordering or
> strictness annotations do not help.
>
> Greetings and sorry for the confusion,
> Joachim
>
>
> --
> Dipl.-Math. Dipl.-Inform. Joachim Breitner
> Wissenschaftlicher Mitarbeiter
> http://pp.info.uni-karlsruhe.de/~breitner



More information about the Haskell-Cafe mailing list