
12 Aug
2012
12 Aug
'12
3:24 a.m.
Antoine Latter wrote:
It should be pretty easy to write an adapter function of type "String -> (Show a => a)".
The type needs to be String -> (exists a. Show a => a) which is equivalent to String -> (forall a. Show a => a -> c) -> c Here is the implementation of the adapter newtype ExistsShow = E { showE :: String } instance Show ExistsShow where show = showE withShow :: String -> (forall a. Show a => a -> c) -> c withShow s f = f (E s) Essentially, the point is that the types are equivalent ExistsShow == exists a. Show a => a Best regards, Heinrich Apfelmus -- http://apfelmus.nfshost.com