[prev in list] [next in list] [prev in thread] [next in thread] 

List:       haskell-cafe
Subject:    Re: Strictness annotations
From:       ajb () spamcop ! net
Date:       2003-10-21 7:42:54
Message-ID: 1066722174.bac454e089f95 () webmail ! spamcop ! net
[Download RAW message or body]

G'day all.

Quoting John Meacham <john@repetae.net>:

> I can't speak for why they weren't included in Haskell 98, but on
> occasion I have wanted something like
> 
> f :: Int -> !Int -> Int
> f x y = foo
> 
> which would translate to:
> 
> f :: Int -> Int -> Int
> f _ y | seq y False = undefined
> f x y = foo
> 
> although I am not sure how useful it would actually be.

Although that's not quite what you want.  Having ! part of the type
signature suggests that it's the caller's job to do the seq, not the
callee's.  This way, you can avoid the eval if the caller has already
evaluated the argument, or if the caller knows that evaluation is a no-op.

> another thing which might be handy is ' !' completely analogous to $!,
> with the exact same precedence as normal functional application (think
> space-bang, just like dollar-bang)

Yes, I don't like the precedence (or associativity, for that matter) of
$! either.

Cheers,
Andrew Bromage

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic