self-import

Thomas Hallgren hallgren at cse.ogi.edu
Tue Jan 18 17:12:01 EST 2005


Simon Peyton-Jones wrote:

>I quite liked this idea until I thought of this:
>
>	module Doc.Pretty.Long( M.f, f ) where
>	  import qualified M( f )
>	  import Doc.Pretty.Long as M
>
>	  f x = x
>
>The second import decl imports all the things exported by
>Doc.Pretty.Long. But what does it export?  Well, M.f.  But what is M.f.
>Well, it could be the f coming from 'import M.f'.  But wait!
>Doc.Pretty.Long exports the locally-defined f too... and the second
>import decl will make that be called M.f too.
>  
>
Our module system paper has answers to this type of questions, since it 
deals with the meaning of recursive modules:

    http://www.cse.ogi.edu/~diatchki/hsmod/

It is implemented in the Programatica Haskell front-end, which thus 
supports modules importing themselves in particular, and mutually 
recursive modules in general, without the need for boot .hi files. I 
wonder when other Haskell implementations are going to catch up? :-)

-- 
Thomas H



More information about the Glasgow-haskell-users mailing list