{-# LANGUAGE FlexibleInstances #-} -- | The 'Vector' class represents elements of a normed vector -- space. We define instances for all common numeric types. module Vector where import Data.Number.BigFloat class Vector a where norm :: RealFrac b => a -> b -- Define instances for common numeric types. instance Vector Integer where norm = fromInteger instance Vector Rational where norm = fromRational instance Epsilon e => Vector (BigFloat e) where norm = fromRational . toRational instance Vector Double where norm = fromRational . toRational