[Haskell-cafe] Best way to instance Fix?
Sam Martin
sam.martin at geomerics.com
Sun May 23 21:13:32 EDT 2010
Hi!
I'm trying to work out the best way to generate (ideally derive) instances for the Fix type. Here's a cut down example:
data Greet x = AlloAllo x x | AuRevoir deriving Show
newtype Fix f = In { out :: f (Fix f) } -- deriving Show -- DOESN'T COMPILE
-- workaround
instance Show (Fix Greet) where show (In i) = "In " ++ show i
In other words, given a number of parametised types that I can derive, say, Ord, Eq and Show for, how should I go about getting the instances for the Fix-d version of them as well? I've tried a few things, but no luck so far.
Any clues?
Cheers,
Sam
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20100523/812a6973/attachment.html
More information about the Haskell-Cafe
mailing list