Jan de Wit wrote:

> Would it be possible to supply a function of type String -> String 
> which is applied to every non-command input to Hugs? Of course, this
> function should be the identity by default!

Sounds like a great idea.  Some thoughts:

> Here's a silly example of my intended use:
> # setPreprocessor reverse
> > :: IO ()

This should be a Hugs command, and probably also definable from the 
command line, so how about:

> # :set -Treverse

where 'T' stands for 'Translator'.

> More seriously, it would allow the programmer to parse user input 
> in an arbitrary way, process the syntax tree, and return a Haskell 
> expression which is (should be) related to the entered expression. You 
> could, for instance, turn all implicit applications into $!'s thereby 
> making Haskell quite strict, like this:

I wonder if String->String is really the right type.  Perhaps it should be

preproc :: Either String HaskellAST -> Either String HaskellAST

which allows optional use of Hugs' built-in parser on the user-entered text, and 
optional bypassing of the parser on the output.  This would make your strictness 
example much easier, by allowing the Haskell parsing to be done for you, and would 
make the earlier example safer by allowing you to build an AST rather than a string.

Of course, we have to decide on HaskellAST... hasn't some work been done on this 
already?

Just my �0.02.

--KW 8-)
-- 
: Keith Wansbrough, MSc, BSc(Hons) (Auckland) -------------------:
: PhD Student, Computer Laboratory, University of Cambridge, UK. :
: Native of Antipodean Auckland, New Zealand: 174d47'E, 36d55'S. :
: http://www.cl.cam.ac.uk/users/kw217/ mailto:[EMAIL PROTECTED] :
:----------------------------------------------------------------:


Reply via email to