Naming types

Ian Lynagh igloo at earth.li
Wed Sep 24 15:19:51 EDT 2008


On Tue, Sep 23, 2008 at 11:57:24PM +0200, Sean Leather wrote:
> >
> > I've written down the issues and made some proposals here.
> > http://hackage.haskell.org/trac/ghc/wiki/Design/TypeNaming
> 
> What purpose does the "type" disambiguating specifier serve in proposal 1?
> Don't type synonyms have the same namespace as datatypes? It would make
> sense to me to match (export specifier<->declaration) data<->data,
> newtype<->newtype, and type<->type for explicit documentation purposes in
> the export list rather than combine data and newtype into data and leave
> type as type.

Presumably if you can say "newtype Foo" in an export list then you can
also say it in an import list. But you don't know if Data.Set.Set was
defined with newtype or data, so I don't think that different keywords
should be used when importing it.

I don't understand why type synonyms must be distinguished, though.
Can't we export things defined with type, data and newtype all with
"type Foo"?



Another thing I'm unclear on: Currently these two type signatures are
equivalent:
    f :: (a + b) -> a
    f :: x a b -> a
Will that still be the case if a type (+) hasn't been defined?
If so, I think that you should need to use an explicit forall if you
want to use (+) as a type variable.

I'm not really convinced that there should be different rules for the
value and type levels, though.



I haven't fully read the second proposal yet, but isn't it orthogonal to
the first? It looks to me like the solution is less clear, so I think
that it would be better to keep the two proposals completely separate.


Thanks
Ian



More information about the Cvs-ghc mailing list