Effective Haskell: B6.0, Chapter 4, p.148: dimension mismatch

@RebeccaSkinner

In the section “Wrapping Basic Data Types”, there is the velocity function and gravity (i.e. on earth at sea level) is being defined as a velocity, but gravity is an acceleration, not a velocity and has dimensions length / time squared, so the dimensions are off.

So I would suggest using a real velocity here like the speed of light:

speedOfLight :: Double
speedOfLight =
  let
    meters = 299792458.0 :: Double
    seconds = 1.0 :: Double
  in velocity meters seconds
1 Like