I would be really glad, if someone could get me a hint how pattern matching should work in haskell. I have already spent hours with watching different tutorials but i don't get it.
I have the data type Assignment with the following instance:
data Assignment = EmptyA | Assign String Integer Assignment
deriving Show
myAssn = Assign "x" 1 (Assign "x" 2 (Assign "y" 3 EmptyA))
Now i want to write a function that returns me the number to a given String. For example should lookupA myAssn "y" return 3:
lookupA :: Assignment -> String -> Integer
lookupA EmptyA _ = 0
lookupA assn s = ???