Strictness

LA home
Computing
FP
 Haskell
  Haskell98
   Strictness

Data Constructors

Data constructors in Haskell are lazy, which is usually what you want (recalling D.P.Friedman & D.S.Wise, Cons should not evaluate its arguments, Automata, Languages and Programming, Edinburgh University Press, pp.257-284, 1976). However the strictness flag, !, can be used to indicate that a field should be evaluated strictly, not lazily.

Functions

"There is no corresponding way to mark function arguments as being strict, although the same effect can be obtained using the seq or !$ functions." -- §6.1 A Gentle Introduction to Haskell, Version 98.

seq :: a-> b -> b -- §6.2 Haskell-98 Report, Feb 1999
seq ⊥ b = ⊥
seq a b = b, if a ≠ ⊥
 
f $! x = x `seq` f x

[wc.hs] contains some experiments with strictness.

www #ad:

Haskell:
(:) cons
[x1,...] list
[ ]list
(++) append
\ λ :-)
:: has type
Compared

↑ © L. Allison, www.allisons.org/ll/   (or as otherwise indicated).
Created with "vi (Linux)",  charset=iso-8859-1,   fetched Wednesday, 24-Apr-2024 19:55:33 UTC.

Free: Linux, Ubuntu operating-sys, OpenOffice office-suite, The GIMP ~photoshop, Firefox web-browser, FlashBlock flash on/off.