Added Haskell median-of-three equivallent ver.