
I had the exact same problem in my regional-pointers package in the withArray function:
withArray ∷ (Storable α, MonadCatchIO pr) ⇒ [α] → (∀ s. RegionalPtr α (RegionT s pr) → RegionT s pr β) → pr β
I had to replace the original:
withArray vals = withArrayLen vals ∘ const
with:
withArray vals f = withArrayLen vals $ \_ → f
where:
withArrayLen ∷ (Storable α, MonadCatchIO pr) ⇒ [α] → (∀ s. Int → RegionalPtr α (RegionT s pr) → RegionT s pr β) → pr β
So unfortunately you gave to inline the function composition:
pair2 combinator = pair1 $ \b -> combinator (chooseBinder b)
This worked for me, thank you! I was worried I'd have to make a sweeping change to the module interfaces. I find this solution rather surprising, but as long as it's localized I don't mind.
Note that in the other thread I'm describing a similar problem in my usb-safe package. Where in essence the problem is that the following won't type check:
foo :: (forall s. ST s a) -> a foo st = ($) runST st
but the following will:
foo :: (forall s. ST s a) -> a foo st = runST st
and surprisingly the following will also type check:
foo :: (forall s. ST s a) -> a foo st = runST $ st
Yes, I hadn't seen that thread until this morning. The same issue with impredicative types appears to cause my problem and both problems you've encountered. I wonder what percentage of Hackage libraries will be affected by the change.