Fix for building Data.Aeson.TH with GHC-6.12.3.
When quoting an expression with a higher ranked type in GHC-6.12.3 like:
[e|V.create :: (forall s. GHC.ST.ST s (Data.Vector.Mutable.MVector s a))
-> Data.Vector.Vector a|] `appE` ...
the following error is thrown:
Cannot match a monotype with `(forall s.
GHC.ST.ST s (Data.Vector.Mutable.MVector s a))
-> Data.Vector.Vector a'
Probable cause: `V.create' is applied to too few arguments
The solution is not to quote the expression but to quote the name instead
and manually turn it into a variable.
commit4d545f7822c28dd7e3c3acc705d06bfc52fbdcbb
authorBas van Dijk <v.dijk.bas@gmail.com>
dateWed 30 Nov 2011, 10:56 (15 years ago)
parenteddbbf5
Data/Aeson/TH.hs+1−1
@@ -353,7 +353,7 @@ encodeArgs withExp _ (NormalC conName ts) = do
353353 ]
354354 ret = noBindS $ [e|return|] `appE` varE mv
355355 return $ [e|Array|] `appE`
356− ([e|V.create|] `appE`
356+ (varE 'V.create `appE`
357357 doE (newMV:stmts++[ret]))
358358 match (conP conName $ map varP args)
359359 (normalB $ withExp js)