Physics engine in Haskell