by jweese · 12y ago · 0 comments
newtype Kilogram = Kilogram Double
which has no runtime overhead but does enforce the fact the Kilogram is a distinct type. {-# LANGUAGE GeneralizedNewtypeDeriving #-}
newtype Kilogram = Kilogram Double deriving (Show, Eq, Ord, Num, Real, Fractional, Floating, ...)
And remind ourselves that Haskell is really quite expressive.