cvs commit: fptools/ghc/compiler/ghci InteractiveUI.hs
Marcin 'Qrczak' Kowalczyk
qrczak@knm.org.pl
23 Mar 2001 00:14:17 GMT
I haven't seen replies for this, so I hope it was forgotten and not rejected:
11 Feb 2001 15:07:37 GMT, Marcin 'Qrczak' Kowalczyk <qrczak@knm.org.pl> pisze:
> Sun, 11 Feb 2001 06:33:27 -0800, Simon Marlow <simonmar@glass.cse.ogi.edu> pisze:
>
> > :def <name> <expr>
> > :undef <name>
> >
> > :def defines a new command, :<name>, with the semantics that
> >
> > (<expr> :: String -> IO String)
>
> Wow!
>
> Please consider the syntax
>:def <funbind>
> which defines :<name>, the function name of <funbind>, to execute
> (let <name> :: String -> IO String; <funbind> in <name>)
> so that we can write
>:def date _ = Time.getClockTime >>= print >> return ""
>:def mycd s = Directory.setCurrentDirectory s >> return ""
> etc.
>
> We can also try to unify the return type with (), not only String,
> and treat () as "". This would require to either check the type
> after compilation instead of using textual ":: String -> IO String"
> or write a private class with instances for String and (). Generally
> I think it's best to avoid working on the source text (what if String
> is redefined in this context?).
--
__("< Marcin Kowalczyk * qrczak@knm.org.pl http://qrczak.ids.net.pl/
\__/
^^ SYGNATURA ZASTĘPCZA
QRCZAK