whileM :: Monad m => m Bool -> m () -> m ()
whileM boolAct act = go
  where
    go = do
      p <- boolAct
      when p $ do
        act
        go
whileM :: Monad m => m Bool -> m () -> m ()
whileM boolAct act = go
  where
    go = do
      p <- boolAct
      when p $ do
        act
        go
whileM boolAct act = go
  where
    go = do
      p <- boolAct
      when p $ do
        act
        go