I have a question on pattern matching:
Is it possible to somehow match a (string ++ [char] ++ anotherstring)?
I have tried something like:
f (s++";"++r) = s++r (the rhs is trivial, but its just for testing ;))
But this results in a parse error.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
No, it’s not possible. Pattern matching deconstructs values according to the constructors they were built with, so you can only use constructor applications in pattern matching to describe which values match the pattern and which don’t.
For something like your example, a
caseworks well,