I'm making progress, but how would I make the following a Typeable instance:
data (f :+: g) e = Inl (f e) | Inr (g e) deriving Eq

Here is what I'm using for Expr:
data Expr f = In (f (Expr f))
instance Typeable1 f => Typeable (Expr f) where
    typeOf (In x) = mkTyConApp (mkTyCon "Data.Trie.General.ListGT") [typeOf1 x]

I don't think I can use this for ':+:', because the typeOf instance
only has access to a member of one type at a time.
This may be similar to a definition of Typeable2 for Either, but I
can't find an example to follow for that.

Thanks,
-Ron

On Wed, Jul 9, 2008 at 10:40 PM, Ron Alford <[EMAIL PROTECTED]> wrote:
> Well, my extension of Wouter's datatypes proved to be unweildy....
> So, I'm trying to use
> http://fmapfixreturn.wordpress.com/2008/05/03/simple-extensible-records-now-quick-generic-tricks-pt-1/
> for extensible records.
>
> I ran across my first problem rather quickly!
> data Expr f = In (f (Expr f))
>
> Ok, but to make it part of a record, it needs to implement Data:
> data Expr f = In (f (Expr f)) deriving Data
>
> but this gives
>    No instances for (Data (f (Expr f)), Typeable (Expr f))
>      arising from the 'deriving' clause of a data type declaration
>                   at Planning/Wouter.hs:77:0-42
>
> Any hints?
>
> Thanks,
> -Ron
>
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to