http://pod-baobabom.livejournal.com/ ([identity profile] pod-baobabom.livejournal.com) wrote in [personal profile] deniok 2014-10-31 05:59 pm (UTC)

Ну вот примерно так.

let evenOnly = snd . foldr (\x z -> let (os,es) = z in (x:es,os)) ([],[])

В оригинальном примере явный pattern matching в параметре автоматически делает функцию строгой по второму аргументу. Что происходит внутри -- хорошо видно при вызове ghc -O -ddump-stranal. В первом случае demand на параметер -- (S,1*U), во втором -- (L,U(1*U,1*U)).

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting