Re: [Haskell-cafe] Putting constraints on "internal" type variables in GADTs

2011-11-08 Thread Emil Axelsson
2011-11-08 14:59, Felipe Almeida Lessa skrev: On Tue, Nov 8, 2011 at 11:49 AM, Anupam Jain wrote: I can work around this by changing my data type declaration to include Show constraints but I don't want to restrict my data type to only Showable things just so I could have a "Show" instance for

Re: [Haskell-cafe] Putting constraints on "internal" type variables in GADTs

2011-11-08 Thread Tillmann Rendel
Hi, Anupam Jain wrote: -- My datatype data T o where Only ∷ o → T o TT ∷ T o1 → (o1 → o2) → T o2 -- Show instance for debugging instance Show o ⇒ Show (T o) where show (Only o) = "Only " ⊕ (show o) show (TT t1 f) = "TT (" ⊕ (show t1) ⊕ ")" As you noticed, the last line doesn't wor

Re: [Haskell-cafe] Putting constraints on "internal" type variables in GADTs

2011-11-08 Thread Felipe Almeida Lessa
On Tue, Nov 8, 2011 at 11:49 AM, Anupam Jain wrote: > While I understand why I get this error, I have no idea how to fix it! I > cannot put a Show constraint on o1 because that variable is not exposed in > the type of the expression. That means 'o1' is an existencial variable. > I can work aroun

[Haskell-cafe] Putting constraints on "internal" type variables in GADTs

2011-11-08 Thread Anupam Jain
Hi all, I was trying to do something very simple with GADTs when I ran into this problem - -- My datatype data T o where Only ∷ o → T o TT ∷ T o1 → (o1 → o2) → T o2 -- Show instance for debugging instance Show o ⇒ Show (T o) where show (Only o) = "Only " ⊕ (show o) show (TT t1 f) = "TT (