[Haskell-cafe] Ambiguous type variable ‘f0’ arising from a use of ‘f’

Tom Ellis tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk
Sat Mar 19 23:03:30 UTC 2016


Can anyone explain what happened in GHC 8 such that it forced this change:

    -data PackMap a b s t = PackMap (Applicative f => (a -> f b) -> s -> f t)
    +data PackMap a b s t = PackMap (forall f. Applicative f => (a -> f b) -> s -> f t)

   ...
    
     instance PP.SumProfunctor (PackMap a b) where
    -  f +++! g = (PackMap (\x -> eitherFunction (f' x) (g' x)))
    -    where PackMap f' = f
    -          PackMap g' = g
    +  f +++! g =
    +    PackMap (\x ->
    +               case f of
    +                 PackMap f' ->
    +                   case g of
    +                     PackMap g' ->
    +                       eitherFunction (f' x)
    +                                      (g' x))

    https://github.com/tomjaguarpaw/haskell-opaleye/pull/140/files

The errors are

    Ambiguous type variable ‘f0’ arising from a use of ‘f’

etc., as seen here

    https://github.com/tomjaguarpaw/haskell-opaleye/pull/140#issuecomment-198297953

Thanks,

Tom


More information about the Haskell-Cafe mailing list