[Haskell] Real life examples

John Meacham john at repetae.net
Wed Nov 24 16:37:47 EST 2004

On Wed, Nov 24, 2004 at 03:48:56PM +0000, Keean Schupke wrote:
> Having admited to wavering on the edge of accepting top level TWIs, perhaps
> one of the supporters would like to comment on qualified importing... IE 
> what
> happens to the unique property if I import 2 copies like so:
>    module Main where
>    import Library as L1
>    import Library as L2
> Although each library's internal state is initialised once, as required, 
> any real
> IO could lead to problems... With the device driver example I now have two
> bits of code that think they have exclusive access to the device... But 
> I can do:

Hmm? I am not really sure what you are asking. With my mdo proposal, and
I think all proposals brought forth, the module system behaves identically
to how it normally does for namespace control. top level initializers
are just constant definitions for all most everything is concerned.  

modules do not change code at all, they are pure syntantic sugar for
deciding what names you can see.

i.e. it does not matter whether you do

import List as L1
import List as L2

L1.sort and L2.sort refer to the same thing. it would be no different if
sort were written with global state or even was a top level binding.

John Meacham - ⑆repetae.net⑆john⑈ 

More information about the Haskell mailing list