[Haskell-cafe] FW: Treating command-line arguments as a Haskell expression

Sterling Clover s.clover at gmail.com
Mon Dec 24 11:50:13 EST 2007

As the previous answers show, hooking dynamic evaluation, or a subset  
thereof, into Haskell is not a particularly easy task. If this is  
just a program to get up-and-running with understanding Haskell,  
probably best not to delve into this sorts of stuff? A simpler  
solution, albeit one which requires some boilerplate, would be to  
ensure that either all the functions you dispatch to call getArgs  
themselves (i.e. are of type IO ()) or simply take a list of  
remaining parameters (i.e. are of type [String] ->IO ()) and then  
pull them out of either a list or a map. Something resembling this  
approach is, for example, here: http://haskell.org/haskellwiki/ 


P.S. using Template Haskell to solve this would be a fairly  
interesting exercise as well, I suspect.

More information about the Haskell-Cafe mailing list