-- Lambda-lift kernels

lambdaLift :: forall m a . MonadCheck m => AST a -> a -> m a
lambdaLift ExpA (CallE (LamE vtaus m) es) = do
    let vs' =  Set.toList (fvs ExpA m)
    taus'   <- mapM lookupVarType vs'
    return $ CallE (LamE (vtaus ++ vs' `zip` taus') m)
                   (es ++ map VarE vs')
lambdaLift :: forall m a . MonadCheck m => AST a -> a -> m a
lambdaLift ExpA (CallE (LamE vtaus m) es) = do
    let vs' =  Set.toList (fvs ExpA m)
    taus'   <- mapM lookupVarType vs'
    return $ CallE (LamE (vtaus ++ vs' `zip` taus') m)
                   (es ++ map VarE vs')
lambdaLift ExpA (CallE (LamE vtaus m) es) = do
    let vs' =  Set.toList (fvs ExpA m)
    taus'   <- mapM lookupVarType vs'
    return $ CallE (LamE (vtaus ++ vs' `zip` taus') m)
                   (es ++ map VarE vs')