[Haskell-cafe] Data.Map.Map Pattern Matching

Jochem Berndsen jochem at functor.nl
Wed May 13 13:52:01 EDT 2009


Nico Rolle wrote:
> Hi
>
> I tried this but it diddn't work in ghci:
>
> import qualified Data.Map as Map
>
> test :: Map.Map [Int] [[Int]] -> Bool
> test (fromList[((i:is), (j:js))]) = [i] == j
>
> i get the : "Parse error in pattern
> Failed." error.

Pattern matching only works on constructors (and view patterns, but they
are a bit more advanced.) I'm not sure what you are trying to
accomplish, could you elaborate?

Cheers,
-- 
Jochem Berndsen | jochem at functor.nl
GPG: 0xE6FABFAB


More information about the Haskell-Cafe mailing list