univar :: Env -> Int -> Maybe Int
univar cl v = f cl v 0
 where
 f [] v v' = Just (v' + v)
 f (Lift n : _) v v' | v < n = Nothing
 f (Lift n : xs) v v' = f xs (v - n) v'
 f (Sub _ : xs) v v' = f xs v (v' + 1)
 f (Skip : _) 0 v' = Just v'
 f (Skip : xs) v v' = f xs (v - 1) (v' + 1)
univar :: Env -> Int -> Maybe Int
univar cl v = f cl v 0
 where
 f [] v v' = Just (v' + v)
 f (Lift n : _) v v' | v < n = Nothing
 f (Lift n : xs) v v' = f xs (v - n) v'
 f (Sub _ : xs) v v' = f xs v (v' + 1)
 f (Skip : _) 0 v' = Just v'
 f (Skip : xs) v v' = f xs (v - 1) (v' + 1)
univar cl v = f cl v 0
 where
 f [] v v' = Just (v' + v)
 f (Lift n : _) v v' | v < n = Nothing
 f (Lift n : xs) v v' = f xs (v - n) v'
 f (Sub _ : xs) v v' = f xs v (v' + 1)
 f (Skip : _) 0 v' = Just v'
 f (Skip : xs) v v' = f xs (v - 1) (v' + 1)