
It should be possible to change (1) the environment returned by System.getEnv (2) the arguments returned by System.getArgs (3) System.getProgName in GHCi (for example, using :set). By the way, my partial solution to grumble (1) is :def modules (\ modulesStr -> do { let { imports = Prelude.map (\ modName -> ("import "++(if modName == "+" then "Prelude" else modName)++"\n")) (Prelude.words modulesStr) ; imod = "module XYZZY where \n"++(Prelude.concat imports) } ; Prelude.writeFile "/tmp/XYZZY.hs" imod ; Prelude.return ":load /tmp/XYZZY.hs" } ) Now if only I had a Haskell function for replacing a Haskell declaration or expression using layout with the appropriate ({/;/}) functions, I could write a :def macro :code (complicated thing split over several lines) :edoc which put everything together and compiled it. Is there a contest for "Worst Abuse of :def"?
participants (1)
-
George Russell