[Haskell-cafe] More idiomatic use of strictness
tux_rocker at reinier.de
Thu Jul 10 06:48:27 EDT 2008
Op Thursday 10 July 2008 12:16:25 schreef Grzegorz Chrupala:
> Is there a less ugly way of avoiding laziness in the code pasted below then
> the use of seq in the last line?
You could replace the list dfs' with a strict list type, like:
data StrictList a = Cons !a !(StrictList a) | Nil
Then you wouldn't have to make useless calls to sum and seq to force
strictness. It would be more work though because you'd have to define your
own higher order functions to work with the strict list.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 197 bytes
Desc: This is a digitally signed message part.
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20080710/a9f33a4d/attachment.bin
More information about the Haskell-Cafe