Talk:Maintaining laziness

From HaskellWiki
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)