
Andrew Wagner wrote:
Hmm, I actually simplified my problem too much. What I actually want is: data Foo a = forall a. Bar a => Foo a Bool
...except I want the 'a' on the left to match the 'a' on the right, so that you can only construct values out of values of the parameterized type, which also must be of the Bar class.
Well, you can ignore my previous contribution to this thread anyway. I failed to see the numerous other responses suggesting the same thing. I recommend against what you are wanting to do. It is probably nicer to have something like this: data Foo a = Foo a Bool -- don't export this foo :: Bar a => a -> Bool -> Foo a -- export this foo = Foo You can also use GHC's new ViewPatterns extension if you would still like to be able to pattern match on Foo values in other modules and don't mind being restricted to more recent versions of GHC. - Jake