[Haskell-cafe] Is it possible to export module aliases?

Brian Hulley brianh at metamilk.com
Thu May 4 04:11:58 EDT 2006


Simon Peyton-Jones wrote:
> Are you asking for the same thing as described under "Permit qualified
> exports" on this Haskell Prime page?
>
>
> http://haskell.galois.com/cgi-bin/haskell-prime/trac.cgi/wiki/ModuleSystem

Yes - thanks for pointing out this section of the proposal.
I think it would be very useful indeed, because I'm finding that the use of 
qualified imports in my code is essential to avoid name clashes and also 
helps with consistent naming for functions.
It also allows more freedom in choosing value constructors and record field 
names without worrying about name clashes or having to prepend the name of 
the type to everything.

As an aside, an alternative to the second point would be to make value 
constructors and field names local to their type so that

    data T = Foo{field::Int}

would introduce the following:

    T, T^Foo, T^field        -- top level names

    -- a global type class
    class (.field) a b | a -> b where
           (.field) :: a -> b

     -- a local instance
     instance T (.field) where
          (.field) Foo{field=f} = f

and type inference could allow the use of plain Foo and field only when the 
type at that location was known to be T (eg making use of user-supplied top 
level type annotations) but this would require some major changes to the way 
type inference is done so it's probably not possible for Haskell'.

Regards, Brian. 



More information about the Haskell-Cafe mailing list