cvs commit: fptools/ghc/compiler/ghci InteractiveUI.hs

Simon Marlow simonmar@microsoft.com
Fri, 23 Mar 2001 10:59:18 -0000


I haven't forgotten it, I just can't see a good way to implement it.
Parsing a <funbind> would involve an extra entry point into the parser,
and various other parts of the system would need extra code to deal with
it.  The advantage of the current scheme is that it's trivial to
implement.

it's not much harder to write

	Prelude> let date _ =3D Time.getClockTime >>=3D print >> return ""
	Prelude> :def date date

Cheers,
	Simon

> -----Original Message-----
> From: Marcin 'Qrczak' Kowalczyk [mailto:qrczak@knm.org.pl]=20
> Sent: Friday, March 23, 2001 12:14 AM
> To: cvs-ghc@haskell.org
> Subject: Re: cvs commit: fptools/ghc/compiler/ghci InteractiveUI.hs
>=20
>=20
> I haven't seen replies for this, so I hope it was forgotten=20
> and not rejected:
>=20
> 11 Feb 2001 15:07:37 GMT, Marcin 'Qrczak' Kowalczyk=20
> <qrczak@knm.org.pl> pisze:
>=20
> > Sun, 11 Feb 2001 06:33:27 -0800, Simon Marlow=20
> <simonmar@glass.cse.ogi.edu> pisze:
> >=20
> > >   	:def <name> <expr>
> > >   	:undef <name>
> > >  =20
> > >   :def defines a new command, :<name>, with the semantics that
> > >  =20
> > >   	(<expr> :: String -> IO String)
> >=20
> > Wow!
> >=20
> > 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 _ =3D Time.getClockTime >>=3D print >> return ""
> >:def mycd s =3D Directory.setCurrentDirectory s >> return ""
> > etc.
> >=20
> > 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=20
> if String
> > is redefined in this context?).
>=20
> --=20
>  __("<  Marcin Kowalczyk * qrczak@knm.org.pl http://qrczak.ids.net.pl/
>  \__/
>   ^^                      SYGNATURA ZAST=CAPCZA
> QRCZAK
>=20
>=20
> _______________________________________________
> Cvs-ghc mailing list
> Cvs-ghc@haskell.org
> http://www.haskell.org/mailman/listinfo/cvs-ghc
>=20
>=20