Re: Derived instances

2007-08-31 Thread Fernand
Neil Mitchell a écrit : Use Derive, which does support Generics: http://www-users.cs.york.ac.uk/~ndm/derive/ If you care about portability, and are not using some of the more advanced features of Generics, then you might want to take a look at Uniplate: http://www-users.cs.york.ac.uk/~ndm/unipl

Re: Derived instances

2007-08-31 Thread Neil Mitchell
Hi > I have just discovered Generics in Haskell and, writing some code with > GHC, I wondered about the portability of my code. If you use Data.Generics, your code is not portable - no other Haskell implementation supports the necessary bits. > I can use the -fgenerics to automatically derive in

Derived instances

2007-08-31 Thread Fernand
Hi, I have just discovered Generics in Haskell and, writing some code with GHC, I wondered about the portability of my code. It is possible I overlooked something in the GHC documentation but I did not found a way to obtain, let say, the haskell code for the derived classes. I mean, having th

Re: Automatically derived instances

2005-08-29 Thread Marc A. Ziegert
just try to compile it with ghc -fallow-overlapping-instances -Wall --make Main.hs or inseart sth. like this at the first line: {-# OPTIONS -fglasgow-exts -fffi -fallow-undecidable-instances -fallow-overlapping-instances #-} - marc Am Montag, 29. August 2005 05:25 schrieb Juan Carlos Arev

Re: Automatically derived instances

2005-08-28 Thread Juan Carlos Arevalo Baeza
David Menendez wrote: Juan Carlos Arevalo Baeza writes: The way Haskell type classes work, the overlap is determined without looking at the context, so "Show a" will overlap with every possible instance for Show, including Show Int, which is predefined. Ah. :-P Bummer. I'm not sure

Re: Automatically derived instances

2005-08-28 Thread David Menendez
Juan Carlos Arevalo Baeza writes: >(BCC'ing the GHC bugs list) > >It seems like there's something very funky going on with GHC (6.4) > and automatically deriving instances. Consider this code: > > ---8<-- > 1: class MyClass a > 2: > 3:instance MyClass

Automatically derived instances

2005-08-28 Thread Juan Carlos Arevalo Baeza
(BCC'ing the GHC bugs list) It seems like there's something very funky going on with GHC (6.4) and automatically deriving instances. Consider this code: ---8<-- 1: class MyClass a 2: 3:instance MyClass a => Show a 4: 5:newtype Type1 = Type1 { unType1 ::

Re: Mutually recursive modules and derived instances of Data

2004-10-13 Thread Carsten Schultz
Hi Simon! On Wed, Oct 13, 2004 at 01:21:26PM +0100, Simon Peyton-Jones wrote: > Two fixes suggest themselves > > 1. Separate 'deriving' from the data type decl, so you can say > derive( Data TA, Typeable TA ) > anywhere. People sometimes ask for this for other reasons. Good thing. Plu

Re: Mutually recursive modules and derived instances of Data

2004-10-13 Thread Martin Sjögren
On Wed, 13 Oct 2004 13:21:26 +0100, Simon Peyton-Jones <[EMAIL PROTECTED]> wrote: > 1. Separate 'deriving' from the data type decl, so you can say > derive( Data TA, Typeable TA ) > anywhere. People sometimes ask for this for other reasons. > > 2. Allow instances in hi-boot files > > Y

RE: Mutually recursive modules and derived instances of Data

2004-10-13 Thread Simon Peyton-Jones
| If I have two modules which are mutually recursive; | | module A where | import B | data TA = TA TB deriving (Data, Typeable) | | module B where | import A | data TB = TB TA deriving (Data, Typeable) | | How do I go about writing a hi-boot that will work in GHC? Good question. At the moment

Mutually recursive modules and derived instances of Data

2004-10-11 Thread Simon David Foster
Hi, If I have two modules which are mutually recursive; module A where data TA = TA String deriving (Data, Typeable) module B where data TB = TB TA deriving (Data, Typeable) How do I got about writing a hi-boot that will work in GHC? The problem is that to do proper XML Schema mappi