
28 Sep
2010
28 Sep
'10
10:07 a.m.
Dear all, I want to have a function that acts only on lists of length 3 (I have a function that filters a list of lists and returns only those of that length). I guess I could change them into tuples (is there a way?), but anyway. Is there a way to specify in the signature that the function should only match such lists, or do I have to do pattern mattching in order to exclude other possibilities?: getTernaryRelationship :: [a] -> [a] getTernaryRelationship ls = if (length ls /= 3) then error "not a ternary rel" else ... thanks Martin