Strictness annotations

ajb at ajb at
Tue Oct 21 04:42:54 EDT 2003

G'day all.

Quoting John Meacham <john at>:

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

Andrew Bromage

More information about the Haskell-Cafe mailing list