Can I program this is Haskell?
Yes! Mathematics and Computation | Seemingly impossible functional programs