lazy – How can I make a shorter binary rule in haskell?

Here is a code I experimented with recently:

let br = (0):(n:concat $ take n br) | n <- (1..)) in concat br

This code produces the binary rule 0 1 0 2 0 1 0 3 ...

Here is the idea of how it works:

  • create a list starting with (0)

  • each step, concatenate all the current elements in the list, put the next number at the begining and add at the end.

((0) ...)
((0), (1, 0) ...)
((0), (1, 0), (2, 0, 1, 0)...)
((0), (1, 0), (2, 0, 1, 0), (3, 0, 1, 0, 2, 0, 1, 0) ...)
...

My question now is: is there a shorter/smarter one-liner to get this infinite lazy binary-rule ?

Edit:

I found another way to do the same thing:

let f n = if n==0 then (0) else n:((0..n-1) >>= f) in (0..)>>= f

The extra question would be: wich one of the 2 version is more readable for an haskell programmer, and why ?