Skip to content
Snippets Groups Projects
Commit 434944a8 authored by Ross Paterson's avatar Ross Paterson Committed by Ian Lynagh
Browse files

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.
parent c7fbd95b
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment