Quadratic irrationals in Haskell