Re: a universal printer for Haskell?

Hi all, This thread started with the consideration of a means (hack?) to implement a generic printer in Haskell. It has moved to the bigger issue of Meta programming, in particular reflection. I think this is a topic worthy of consideration, and something we don't seem to talk much about in these groups.
Ashley Yakeley writes: What I would hate to see is widespread use of reflection in general programs. It rather seems to miss the point of Haskell's type system.
I think the point of Haskell's type system varies depending on who you ask. The rules may be fixed to a certain degree in Haskell 98, but future versions of the language are free to change them. Meta programming is made more difficult when you have a strong static type system, no doubt. But is that a problem of meta programming or of the type system? This is a matter of opinion. Systems such as Meta ML [1], show that the two can be made compatible. I must admit that I haven't used Meta ML, so I'm not in a position to evaluate it, although it does make for some interesting research. My point is that there are some things that can't easily be expressed in current Haskell (like generic printing) that are useful and might be aided by meta-programming technology. The interesting question is can it be done in a way that preserves whatever we want from the type system: safety, security, efficiency, error detection ...
And I don't want other people peeking inside my types at run-time.
There are numerous ways to provide security for your data types. You can specifically request that they not be made visible to the meta facility, or you can use a module system to grant access to the implementation of data only in certain modules. It does not have to be program wide. The scheme I suggested for generic printing was not as safe as you might like, but it was intended to be simple and easy to implement, and there is some merit in that I think. Cheers, Bernie.

My point is that there are some things that can't easily be expressed in current Haskell (like generic printing) that are useful and might be aided by meta-programming technology. The interesting question is can it be done in a way that preserves whatever we want from the type system: safety, security, efficiency, error detection ...
You don't need meta-programming technology (reflection) to do things like generic prinitng. A generic programming extension of Haskell (like Generic Haskell, or derivable classes) can do the job for you. Have a look at: http://www.generic-haskell.org/ -- Johan

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Wednesday 20 February 2002 08:46, Bernard James POPE wrote:
There are numerous ways to provide security for your data types.
(In)Visibility isn't security. I have more than often witnessed Java users
who thought "private" keyword was for security.
I think it's obvious, with many years of worldwide experience of Internet
security, why obscurity is *not* security.
Thanks,
- --
Eray Ozkural (exa)
participants (3)
-
Bernard James POPE
-
Eray Ozkural
-
Johan Jeuring