Talk:Maintaining laziness

From HaskellWiki
Revision as of 15:22, 4 January 2009 by Deniok (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Why force function is written in so complicated form? According to the translation rule

let p = e1  in  e0      ~>      case e1 of ~p -> e0

we can obtain

force y = let Just x = y in Just x          ~>
force y = case y of ~(Just x) -> Just x     ~>
force ~(Just x) = Just x

The last definition provides the desired laziness in explicit form. --Deniok 15:22, 4 January 2009 (UTC)