Created
March 15, 2010 08:40
-
-
Save sordina/332630 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE MultiParamTypeClasses, FlexibleContexts #-} | |
{- -- Has the error: | |
Matrix.hs:33:49: | |
Kind error: `m' is applied to too many type arguments | |
In the type `m (Maybe a)' | |
In the type `Integer -> m (Maybe a)' | |
In the type `Integer -> Integer -> m (Maybe a)' | |
--} | |
module Matrix ( | |
Matrix, | |
fromRows, | |
toList, | |
toListWithPos, | |
toRows, | |
rows, | |
columns, | |
at, | |
neighbours, | |
neighbourMap | |
) where | |
import Data.Maybe (catMaybes) | |
class Matrix m | |
where | |
-- required | |
fromRows :: [[a]] -> m | |
rows :: m -> Integer | |
columns :: m -> Integer | |
at :: m -> Integer -> Integer -> a | |
-- defaults | |
toList :: m -> [a] | |
toListWithPos :: m -> [(Integer, Integer, a)] | |
toRows :: m -> [[a]] | |
row :: m -> Integer -> [a] | |
column :: m -> Integer -> [a] | |
vicinityRows :: m -> Integer -> Integer -> [[Maybe a]] | |
vicinityMatrix :: m -> Integer -> Integer -> m (Maybe a) | |
neighbours :: m -> Integer -> Integer -> [a] | |
neighbourMap :: (a -> [a] -> a) -> m -> m |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment