[Haskell-cafe] Pattern matching error
georg_straube at web.de
Thu Dec 6 12:39:05 EST 2007
I need to write a function which should is supposed to merge multiple
entries with the same
key (out of a sorted key-value-list) into one single entry.
However, I keep getting a pattern matching error.
(For example, for input [('b',),('b',),('b',),('b',)]:
"Program error: pattern match failure: kgroup
Thank you very much for your help.
kmerge::Eq a => [(a,[b])]->[(a,[b])]
kmerge  = 
kmerge ((x,[y]):) = [(x,[y])]
kmerge ((x,[y]):(u,[v]):xs) | x == u = kmerge ((x,[y,v]):xs)
| otherwise = (x,[y]):(u,[v]):kmerge xs
View this message in context: http://www.nabble.com/Pattern-matching-error-tf4957268.html#a14196413
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.
More information about the Haskell-Cafe