I want a function like following, is this possible?
in fact, I don’t know if the type Pattern exists.
fun1 a :: Pattern a -> a -> Bool
fun1 pattern a = case a of
pattern -> True
_ -> False
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.
Check out the Functional Pearl, Type Safe Pattern Combinators. A bit of Googling shows that there is a Hackage package based on it as well.