On 02/28/2012 06:40 AM, AntC wrote:
Oliver Batchelor<saulzar<at> gmail.com> writes:
Perhaps this situation could occur though?
Module A
fieldLabel name String
Module B
import A -- unknowingly picking up the name label
data Foo = Foo { name :: String } -- uses the name label by accident
So there'd have to be some syntax to make sure you intend to use a
label rather than accidentally use it?
(Not that this is a big issue, the situation is surely minor compared
to sharing unrelated labels all the time)
Oliver
Thanks Oliver, hmm ...
Oliver's example is exactly what I feel weird about (and what I refered
to as a "magical effect"). Sorry for failing to communicate to you
successfully.
In the meantime, I had an idea (that could work with SORF or DORF) :
data Foo = Foo { name :: String } deriving (SharedFields)
The effect is: without that "deriving", the declaration behaves just
like H98.
(For super flexibility, allow to specify which fields are shared,
like "deriving(SharedFields(name, etc, etc))" perhaps.)
Is it too verbose? Or too terrible that it isn't a real class (well,
there's Has...)?
-Isaac
_______________________________________________
Glasgow-haskell-users mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users