[commit: ghc] master: fix #5022: polymorphic definitions inside arrow rec (4c8e030)
Ross Paterson
ross at soi.city.ac.uk
Tue Dec 20 00:59:43 CET 2011
Repository : ssh://darcs.haskell.org//srv/darcs/ghc
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/4c8e03075ab8719f3753c1a2e4f05ef21be193ac
>---------------------------------------------------------------
commit 4c8e03075ab8719f3753c1a2e4f05ef21be193ac
Author: Ross Paterson <ross at soi.city.ac.uk>
Date: Mon Dec 19 23:44:33 2011 +0000
fix #5022: polymorphic definitions inside arrow rec
This is quite tricky, with examples like this:
import Control.Arrow
pRepeat :: a -> [a]
pRepeat =
proc x -> do
rec
s <- returnA -< f_rec x:s -- f_rec is monomorphic here
let f_later y = y -- f_later is polymorphic here
_ <- returnA -< (f_later True, f_later 'a')
let f_rec y = y -- f_rec is polymorphic here
returnA -< f_later s -- f_later is monomorphic here
Fixed the typechecking of arrow RecStmt to track changes to the monad
version. It was simplest to add a field recS_later_rets corresponding
to recS_rec_rets. It's only used for the arrow version, and always
empty for the monad version. But I think it would be cleaner to put
the rec_ids and later_ids in a single list with supplementary info
saying how they're used.
Also fixed several glitches in the desugaring of arrow RecStmt. The fact
that the monomorphic variables shadow their polymorphic counterparts is a
major pain. Also a bit of general cleanup of DsArrows while I was there.
compiler/deSugar/DsArrows.lhs | 238 +++++++++++++++++++++++---------------
compiler/hsSyn/HsExpr.lhs | 9 +-
compiler/hsSyn/HsUtils.lhs | 2 +-
compiler/typecheck/TcArrows.lhs | 27 +++--
compiler/typecheck/TcHsSyn.lhs | 9 +-
compiler/typecheck/TcMatches.lhs | 3 +-
6 files changed, 174 insertions(+), 114 deletions(-)
Diff suppressed because of size. To see it, use:
git show 4c8e03075ab8719f3753c1a2e4f05ef21be193ac
More information about the Cvs-ghc
mailing list