ssadler / hawk

Awk for Hoodlums
BSD 3-Clause "New" or "Revised" License
35 stars 2 forks source link

Use qualified Representable for map to avoid imports problem #53

Closed melrief closed 11 years ago

melrief commented 11 years ago

In the new version of Hawk the -m option uses the unqualified map function to map the user expression over the input. We should qualify that map or hint will evaluate it based on the user imports. I propose to import Representable both qualified and unqualified and change all the utilities functions with a qualified version like:

runMap :: [String] -> String
runMap = printf "(System.Console.Hawk.Representable.listMap (%s))" . compose

where listMap is just an alias for map over listing. Alternatively we could use fmap but I prefer fix the type of the map to list only for debugging purposes.

melrief commented 11 years ago

Ok I have done it. In this way the user can't interfere with our functions.

gelisam commented 11 years ago

+1