> If you build a language that is based around doing everything with stateless data transformations but doesn't address state and branching, it will eventually be a problem
I'm assuming you are referring to Haskell? It's a general purpose programming language so of course it handles state, branching, etc...
data Tree a = Empty | Leaf a | Node a [Tree a]
deriving stock (Show, Functor, Foldable, Traversable)
label :: Tree a -> Tree (a, Int)
label t = evalState (traverse f t) 0 where
f t' = state (\c -> ((t', c), c + 1))
The above code labels nodes of a multiway tree using a counter. State and branching.