Why does the following Haskell script not work as expected?
find :: Eq a => a -> [(a,b)] -> [b] find k t = [v | (k,v) <- t]
Giv
You can only pattern match on literals and constructors. You can't match on variables. Read more here.
That being said, you may be interested in view patterns.