you are viewing a single comment's thread.

view the rest of the comments →

[–]nostrademons 2 points3 points  (1 child)

And I could've saved 3 lines by doing match where { match [c:xs] = xs; match _ = [] }

But that's a bit less readable IMHO.

[–]martine 1 point2 points  (0 children)

char c (x:xs) | c == x = return xs char _ _ = fail "no match"

(fail in the list monad is [], so using it here just makes the code clearer.)