1 {-# LANGUAGE FlexibleInstances #-}
3 -- | The 'Vector' class represents elements of a normed vector
4 -- space. We define instances for all common numeric types.
8 import Data.Number.BigFloat
11 norm :: RealFrac b => a -> b
13 -- Define instances for common numeric types.
14 instance Vector Integer where
17 instance Vector Rational where
20 instance Epsilon e => Vector (BigFloat e) where
21 norm = fromRational . toRational
23 instance Vector Double where
24 norm = fromRational . toRational