[Haskell-cafe] Avoiding parametric function binding

Kevin Quick quick at sparq.org
Tue Jan 3 07:46:18 CET 2012

On Sun, 01 Jan 2012 05:29:42 -0700, Sebastian Fischer <fischer at nii.ac.jp>  
> On Sat, Dec 31, 2011 at 4:09 PM, Kevin Quick <quick at sparq.org> wrote:
>>  onVarElem :: forall a . (Show a) => (Maybe a -> String) -> Var ->  
>> String
> The problem is the scope of the quantification of the type variable 'a'.
> You can use higher-rank types (via the Rank2Types or RankNTypes language
> extension) to achieve what you want. Change the type of 'onVarElem' to
>     onVarElem :: (forall a . (Show a) => Maybe a -> String) -> Var ->  
> String

Thanks to both Sebastian and Sean for the solution (abbreviated from  
Sebastian's reponse above).


P.S.  Sorry for the late followup: some minor system issues prevented  
checking email for a little while.  The delay notwithstanding, *all* of  
the responses were much appreciated.


More information about the Haskell-Cafe mailing list