Reputation: 553
I have a problem when using case expression in Haskell.
filterSth::[a]->(b,c)->[a]
filterSth (x:xs) (b, c) =
case (b,c) of
(1,0) -> ...
(1,2) -> ...
...
can I do something like above ?
Upvotes: 1
Views: 1801
Reputation: 370367
Yes, you can do something like the above except that b
and c
need to have a numeric type if you want to pattern match them against numeric constants.
Upvotes: 5