Hi, I'm not sure if something like this has been
proposed already but I thought I'd bring it up.
The idea is to allow multiple data declarations to
share constructors by having them be implicitly
declared inside a module. So, for example,
data Dir = Left | Right deriving Show
data Arrived = Arrived | Left deriving Show
main = do
print Dir.Left
print Arrived.Left
will work just fine.
Nothing is required by this proposal that isn't
already done (with the exception of adding syntactic
support to the compiler of course). The above can be
accomplished today by simply putting Dir and Arrived
into their own modules and then importing them.
There is a question of do we provide some means of
abbreviating these implicit module names. If this is
considered desirable, one way of accomplishing this is
to add an as-clause to the data declaration syntax,
which will function similary to where-clauses and
deriving syntax. Ex,
data Dir = Left | Right
as D
deriving Show
This will effectively be the same as declaring Dir in
its own module and then importing it using as syntax.
__
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
___
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell