Then I wanted to write a function that would reverse the (>>= gen) and i came up with this function.
```haskell
revgen (x:xs) =
case (null xs) of
False -> case ((head xs) - x) of
1 -> 1 + revgen xs
otherwise -> 0 : revgen xs
True -> 1 : []
```
But it doesn't work, I think because of the revgen returning both numbers and lists. But I can't come up with a way to do this any other way with one function. Also the nested cases look ugly as hell but I quess they work as intented because at least it compiles.
* * * * *
meditans:
Given the definitions:
```haskell
gen x = [1..x]
f xs = xs >>= gen
```
If you want a function g such that g . f = id, I think you could use: