On Mon, Feb 14, 2005 at 12:36:22PM +0100, Remi Turk wrote: > > Now that this topic is brought up... > > > > Occasionally I would need to define recursive datatypes > > using an explicit fixed-point operator, such as: > > > > > data Fix f = In (f (Fix f)) deriving (Show, Eq) > > > data L a x = Nil | Cons a x deriving (Show, Eq) > > > > However, Haskell was not able to derive from Fix f any > > instances. > > > [snip] > > > > This is rather unsatisfactory, because I would not be able > > to inspect values of type Fix f in the interpreter. Is there > > a way to get around this? > > Funny this comes up at this time, as Fix was on-topic yesterday > at #haskell. One way to make Fix an instance of Show/Eq is this > (based on http://www.haskell.org/hawiki/PreludeExts, where Fix is > called Rec):
It's even more funny - just yesterday I wanted to derive Show and Read for a similar datatype :) Best regards Tomasz -- Szukamy programisty C++ i Haskell'a: http://tinyurl.com/5mw4e _______________________________________________ Haskell mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell
