Reputation: 43111
Haskell has a Data.Map module which includes, among other functions, a !
function.
fromList [(5,'a'), (3,'b')] ! 1 Error: element not in the map
fromList [(5,'a'), (3,'b')] ! 5 == 'a'
While I can import other functions from the Data.Map module into my code...
import Data.Map(Map, keys, fromList)
...the following does NOT work...
import Data.Map(Map, keys, fromList, !)
I get the following error:
parse error on input `!'
What is the correct syntax to import items like !
?
Upvotes: 20
Views: 2937
Reputation: 43111
The correct answer is to wrap the function name (really, it's an operator: a special case of a function) in parentheses, like so...
import Data.Map(Map, keys, fromList, (!))
Upvotes: 31