Strictness

LA home
Computing
 Algorithms
 Bioinformatics
 FP,  λ
 Logic,  π
 MML
 Prog.Langs

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.

window on the wide world:

Computer Science Education Week

Linux
 Ubuntu
free op. sys.
OpenOffice
free office suite,
ver 3.4+

The GIMP
~ free photoshop
Firefox
web browser
FlashBlock
like it says!

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 Saturday, 19-Apr-2014 19:27:43 EST.