Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It's funny to see Haskell and TDD mentioned without QuickCheck http://www.haskell.org/haskellwiki/Introduction_to_QuickChec....

But, yes: referential transparency and functional (rather than sequential) composition make for a different refactoring model, one where eta expansion/contraction is the norm.

He does leave out the opportunity for more fluid refactorings: the lenPreviousLines function could be refactored in a more conventional way (changing the foldr of ((+).length) to a sum---which is a foldl---of a map, for example).



I use QuickCheck, but it wasn't germane the point I was making so I didn't mention it.

Actually, I did think of using sum when I was computing the length differently, but I made another change and never got back to it. I agree, sum would be better.


I didn't mean to snipe: the "funny" I'm using is in a "cite original sources" mode, which has little/nothing to do with the non-academic world. :)




Consider applying for YC's Winter 2027 batch! Applications are open till November 2.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: