check :: Queue a -> Queue a
check q@(Q lenf f state lenr r) = if lenr <= lenf
  then exec2 q
  else exec2 (Q (lenf+lenr) f newstate 0 L.empty)
  where newstate = Reversing 0 f L.empty r L.empty
check :: Queue a -> Queue a
check q@(Q lenf f state lenr r) = if lenr <= lenf
  then exec2 q
  else exec2 (Q (lenf+lenr) f newstate 0 L.empty)
  where newstate = Reversing 0 f L.empty r L.empty
check q@(Q lenf f state lenr r) = if lenr <= lenf
  then exec2 q
  else exec2 (Q (lenf+lenr) f newstate 0 L.empty)
  where newstate = Reversing 0 f L.empty r L.empty