For extra fun, notice that you can make declarations like:

data (Unit u) => Kilo u = Kilo u

instance (Unit u) => Unit (Kilo u) where
    shortName (Kilo u) = "k" ++ shortName u

which behaves in ghci like:
*Main> UnitValue (Kilo Meter) 30
30km

 - Cale
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to