inferType d g (ELetRGN tr1 ta v) = case (inferType d g . valToExp) v of Nothing -> Nothing Just (FForall gr2 (FArrow (FArrow (FArrow (RGN tr1 (FVar gr2')) (RGN (FVar gr2'') gr2''')) (RGNHandle (FVar gr2''''))) (RGN (FVar gr2''''') ta))) | (S.member tr1 d) && (S.member ta d) && gr2 == gr2' && gr2' == gr2'' && gr2'' == gr2''' && gr2''' == gr2'''' && gr2'''' == gr2''''' -> Just $ RGN tr1 ta | otherwise -> Nothing