constructKernels :: AST a -> a -> R r a
constructKernels = go
  where
    go :: AST a -> a -> R r a
    go ExpA e@(ForE forloop _ _) | isParFor forloop = do
        return (CallE (LamE [] e) [])

    go w a = checkTraverseFam go w a

-- Lift shared bindings out of branches
constructKernels :: AST a -> a -> R r a
constructKernels = go
  where
    go :: AST a -> a -> R r a
    go ExpA e@(ForE forloop _ _) | isParFor forloop = do
        return (CallE (LamE [] e) [])

    go w a = checkTraverseFam go w a

-- Lift shared bindings out of branches
constructKernels = go
  where
    go :: AST a -> a -> R r a
    go ExpA e@(ForE forloop _ _) | isParFor forloop = do
        return (CallE (LamE [] e) [])

    go w a = checkTraverseFam go w a

-- Lift shared bindings out of branches