If I have a function that takes a string and say returns an int, I can match the first character of the string, using pattern matching:
f :: String -> Int
f ('A' : _) = 1
f ('B' : _) = 0
f ('C' : _) = 1
f _ = 2
is there a way to match A or C in one? Something like:
f :: String -> Int
f ('A'||'C' : _) = 1
f ('B' : _) = 0
f _ = 2
or even this (which would be useful if there is some calculation rather than just returning a constant_)
f :: String -> Int
f ('A' : _)
f ('C' : _) = 1
f ('B' : _) = 0
f _ = 2