specializing on existentially quantified data types
Simon Peyton-Jones
simonpj at microsoft.com
Tue Nov 25 09:00:09 EST 2003
| class C a where ...
| data MkC = forall a . C a => MkC a
|
| foo :: MkC -> ...
|
| and I want to specialize foo for when the 'a' in the MkC is, say, Int.
Is
| this possible?
Not directly. But you can say
foo (MkC x) = foo' x
foo' :: forall a. C a => a -> ...
foo' x = ...
{-# SPECIALISE foo' :: Int -> ... #-}
There's no built-in mechanism I'm afraid.
Simon
More information about the Glasgow-haskell-users
mailing list