Strictness

home1 home2
 Bib
 Algorithms
 Bioinfo
 FP
 Logic
 MML
 Prog.Lang
and the
 Book

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.

Coding Ockham's Razor, L. Allison, Springer

A Practical Introduction to Denotational Semantics, L. Allison, CUP

Linux
 Ubuntu
free op. sys.
OpenOffice
free office suite
The GIMP
~ free photoshop
Firefox
web browser

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

© L. Allison   http://www.allisons.org/ll/   (or as otherwise indicated),
Faculty of Information Technology (Clayton), Monash University, Australia 3800 (6/'05 was School of Computer Science and Software Engineering, Fac. Info. Tech., Monash University,
was Department of Computer Science, Fac. Comp. & Info. Tech., '89 was Department of Computer Science, Fac. Sci., '68-'71 was Department of Information Science, Fac. Sci.)
Created with "vi (Linux + Solaris)",  charset=iso-8859-1,  fetched Thursday, 25-Apr-2024 19:59:01 AEST.