How to assign type of value of Map in Rascal?

I have a type variable that stores a map, but I cannot access the values ​​by providing the keys:

rascal>a
value: ("s":"s")

rascal>a["s"]
|stdin:///|(2,3,<1,2>,<1,5>): subscript not supported on value at |stdin:///|(2,3,<1,2>,<1,5>)
☞ Advice

How can I parse the value to match to get my value?

+4
source share
1 answer
if (map[str,str] myMap := a) {
   // do stuff with myMap
}
else {
  throw "<a> is not a map?";
}
+5
source

All Articles