Re: [Haskell-cafe] Scraping boilerplate deriving?

2010-09-15 Thread Jonas Almström Duregård
#define defObj(t) newtype t = t Obj deriving (A,B,C,D) Blasphemy! :) On 14 September 2010 23:01, John Meacham j...@repetae.net wrote: On Tue, Sep 14, 2010 at 01:24:16AM -0700, Kevin Jardine wrote: I have a set of wrapper newtypes that are always of the same format: newtype MyType =

[Haskell-cafe] Scraping boilerplate deriving?

2010-09-14 Thread Kevin Jardine
I have a set of wrapper newtypes that are always of the same format: newtype MyType = MyType Obj deriving (A,B,C,D) where Obj, A, B, C, and D are always the same. Only MyType varies. A, B, C, and D are automagically derived by GHC using the {-# LANGUAGE GeneralizedNewtypeDeriving #-} feature.

Re: [Haskell-cafe] Scraping boilerplate deriving?

2010-09-14 Thread Miguel Mitrofanov
class (A x, B x, C x, D x) = U x ? 14.09.2010 12:24, Kevin Jardine пишет: I have a set of wrapper newtypes that are always of the same format: newtype MyType = MyType Obj deriving (A,B,C,D) where Obj, A, B, C, and D are always the same. Only MyType varies. A, B, C, and D are automagically

Re: [Haskell-cafe] Scraping boilerplate deriving?

2010-09-14 Thread Miguel Mitrofanov
Sorry, got stupid today. Won't help. 14.09.2010 12:29, Miguel Mitrofanov пишет: class (A x, B x, C x, D x) = U x ? 14.09.2010 12:24, Kevin Jardine пишет: I have a set of wrapper newtypes that are always of the same format: newtype MyType = MyType Obj deriving (A,B,C,D) where Obj, A, B,

Re: [Haskell-cafe] Scraping boilerplate deriving?

2010-09-14 Thread Sean Leather
On Tue, Sep 14, 2010 at 10:24, Kevin Jardine wrote: I have a set of wrapper newtypes that are always of the same format: newtype MyType = MyType Obj deriving (A,B,C,D) where Obj, A, B, C, and D are always the same. Only MyType varies. A, B, C, and D are automagically derived by GHC using

Re: [Haskell-cafe] Scraping boilerplate deriving?

2010-09-14 Thread Serguey Zefirov
2010/9/14 Kevin Jardine kevinjard...@gmail.com: I would like to use some macro system (perhaps Template Haskell?) to reduce this to something like defObj MyType I've read through some Template Haskell documentation and examples, but I find it intimidatingly hard to follow. Does anyone has

Re: [Haskell-cafe] Scraping boilerplate deriving?

2010-09-14 Thread John Meacham
On Tue, Sep 14, 2010 at 01:24:16AM -0700, Kevin Jardine wrote: I have a set of wrapper newtypes that are always of the same format: newtype MyType = MyType Obj deriving (A,B,C,D) where Obj, A, B, C, and D are always the same. Only MyType varies. A, B, C, and D are automagically derived