The dimensional (and dimensional-tf ) package hides operators from Num and Fractional and defines operators with the same name, but different types. These operators do not work with unvarnished number types.
So,
{-# LANGUAGE NoMonomorphismRestriction #-} import Numeric.Units.Dimensional.TF.Prelude import qualified Prelude as P
you can't just write
fourpi = 4 * pi
since (*) :: Num a => Dimensional vda -> Dimensional vd' a -> Dimensional v (Mul d d') a then, and there are no Num instances for dimensional types (cannot be, since the product of two-dimensional types is usually has a different dimension), so 4 and pi cannot be interpreted as values ββof the dimensional type.
However you can write
fourpi = 4 P.* P.pi
etc., qualified versions of operators from Num are still available.
source share