News for hackers. Stuff that matters.
Re:Let the Type System do the Work by jweese on Monday April 21, 2014 @03:12PM (#7623030)
That's why you want

    newtype Kilogram = Kilogram Double
which has no runtime overhead but does enforce the fact the Kilogram is a distinct type.
Re:Let the Type System do the Work by sparkie on Monday April 21, 2014 @05:48PM (#7624175)
We probably wanna add to it to make it useful

    {-# LANGUAGE GeneralizedNewtypeDeriving #-}
   
    newtype Kilogram = Kilogram Double deriving (Show, Eq, Ord, Num, Real, Fractional, Floating, ...)
And remind ourselves that Haskell is really quite expressive.
Re:Let the Type System do the Work by dllthomas on Tuesday April 22, 2014 @06:43AM (#7626835)
Though unfortunately can't handle (mass * accel :: Newton) without swapping out the Prelude.