I defined :
type Network = [(Matrix Double,Vector Double)]
where Matrix and Vector are from the hmatrix library. From the documentation of hmatrix it seems to me that Matrix Double and Vector Double are already instances of Num. Since I need to add and subtract Networks quiet a lot I also want Network to be an instance of Num. I tried
instance Num Network where
(+) = zipWith (\(m,v) (n,w) -> (m+n,v+w))
(-) = zipWith (\(m,v) (n,w) -> (m-n,v-w))
(*) = zipWith (\(m,v) (n,w) -> (m*n,v*w))
but I am getting the error : Illegal Instance declaration.