RE: deriving (was Re: storing to a file)

2002-11-15 Thread Simon Peyton-Jones
| I was thinking that it might be nice to be able to write Haskell to
add,
| say, a "deriving XML" or "deriving ASN1" feature whose instances
provide
| methods to convert between Haskell data structures and those formats,
| instead of having to hack the compiler to achieve such automated
method
| writing.

When Template Haskell is out, you'll be able to do just that, I think.

Simon
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe



Re: deriving (was Re: storing to a file)

2002-11-15 Thread Mark Carroll
On Thu, 14 Nov 2002, matt hellige wrote:
(snip)
> well, here's one way it might work:
> http://research.microsoft.com/~simonpj/Papers/derive.htm

I'll take a look at that - thanks - it might answer a few of my "generic
programming" questions.

> although i'm not exactly sure what you mean by 'add your own
> "deriving" things'... :)

I was thinking that it might be nice to be able to write Haskell to add,
say, a "deriving XML" or "deriving ASN1" feature whose instances provide
methods to convert between Haskell data structures and those formats,
instead of having to hack the compiler to achieve such automated method
writing.

BTW, those typed returns on sockets that Shawn mentioned sounded
interesting. IIRC Modula-3 also had some approach to worrying about data
exchange between older and newer versions of the same program.

-- Mark

___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe



Re: deriving (was Re: storing to a file)

2002-11-14 Thread matt hellige
On Thu, Nov 14, 2002 at 09:56:24AM -0500, Mark Carroll wrote:

> Actually, "deriving binary" would be a nice
> thing to have in general - even more, a way to add your own "deriving"
> things from within Haskell, although I have no idea how such a thing would
> work.

well, here's one way it might work:
http://research.microsoft.com/~simonpj/Papers/derive.htm

although i'm not exactly sure what you mean by 'add your own
"deriving" things'... :)

matt

-- 
matt hellige  [EMAIL PROTECTED]
http://matt.immute.net
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe



Re: deriving (was Re: storing to a file)

2002-11-14 Thread Hal Daume III
> Actually, there's one situation where it would work easily, and that
> is when used with newtype.  Apart from "Show" and "Read", which are
> special cases anyway, the "deriving" operation on newtype has a simple
> meaning: inherit instances from the type being wrapped.

GHC does this on newtypes already.

___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe



deriving (was Re: storing to a file)

2002-11-14 Thread Andrew J Bromage
G'day all.

On Thu, Nov 14, 2002 at 09:56:24AM -0500, Mark Carroll wrote:

> Actually, "deriving binary" would be a nice
> thing to have in general - even more, a way to add your own "deriving"
> things from within Haskell, although I have no idea how such a thing would
> work.

Actually, there's one situation where it would work easily, and that
is when used with newtype.  Apart from "Show" and "Read", which are
special cases anyway, the "deriving" operation on newtype has a simple
meaning: inherit instances from the type being wrapped.

Thoughts?

Cheers,
Andrew Bromage
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe