[Haskell-beginners] Could not deduce (Matrix m (Maybe a)) from the context (Matrix m a)

Lyndon Maydwell maydwell at gmail.com
Fri Jan 29 06:11:43 EST 2010


Ah, yes. That might be just what I'm after!

> However, having a look, none of the methods in the class look like they
> depend on the actual type a, so it might be better to have
>
> class Matrix m where
>    fromRows :: [[a]] -> m a
>    toList :: m a -> [a]
>    rows :: m a -> Integer
>    columns :: m a -> Integer
>    row :: m a -> Integer -> [a]
>    column :: m a -> Integer -> [a]
>    at :: m a -> Integer -> Integer -> a
>    (!!!) :: m a -> Integer -> Integer -> a
>    vicinityRows :: m a -> Integer -> Integer -> [[Maybe a]]
>    vicinityMatrix :: m a -> Integer -> Integer -> m (Maybe a)
>    -- No constraint needed!!
>    neighbours :: m a -> Integer -> Integer -> [a]


More information about the Beginners mailing list