The following code
{-# LANGUAGE TypeSynonymInstances, FlexibleInstances #-}
module Function where
import qualified Data.Vector.Unboxed as V
import Control.Monad
type Function = V.Vector Double
instance Num Function where
(+) = liftM2 (+)
(*) = liftM2 (*)
negate = fmap negate
returns errors like
No instance for (Monad V.Vector)
arising from a use of `liftM2'
though it is said in the documentation that Vector is an instance of Monad.
Unboxed
Vectoris not an instance ofMonad. Notice thevectorpackage exports many different types that are all calledVector. Data.Vector.Unboxed.Vector /= Data.Vector.Vector /= Data.Vector.Storable.Vector.