Pattern matching over Data.Map
haskell
Solution
You could pattern match on `M.toList`:
import qualified Data.Map as M
-- ...
main = do
case (M.toList myFunction) of
[a,b,c] -> ... -- exactly 3 arguments
_ -> ... -- more or less than 3 arguments
Problem
I did a search but, surprisingly, didn't find anything that would help me to perform pattern matching over it. I need to make sure that in my Map "variable" exactly 3 keys. That's it. Instead of "if ... then ... else", I want to go with pattern matching as it is easier to read and seems to be more haskell way. So: ``` myFunction :: Map String String --....................... main = do let var1 = myFunction -- how do I ensure it has exactly 3 keys in it and if not raise an error? ```