The reason lists:flatten doesn't work for you is that strings in Erlang are just lists of small integers. We can handle this with a function that stops recursing down in a nested list if the list is just a string.
For arbitrarily nested list of strings you can use the following function:
slab([]) ->
[];
slab([F|R]) ->
case io_lib:char_list(F) of
true -> [F|slab(R)];
false -> slab(F) ++ slab(R)
end.
It uses io_lib:char_list() to decide if the nesting recursion was deep enough.
Exampe of operation:
1> slab([[["foo", "bar"], "baz", [[[["foobar"]]]], "froboz", "the end"]]).
["foo","bar","baz","foobar","froboz","the end"]
2>
A small improvement that would make it possible to use mixed nested lists:
slab([]) ->
[];
slab([F|R]) when is_list(F) ->
case io_lib:char_list(F) of
true -> [F|slab(R)];
false -> slab(F) ++ slab(R)
end;
slab([F|R]) ->
[F|slab(R)].
This behaves just like lists:flatten except that it handles string as if they would be no lists:
1> slab([[["foo", "bar"], "baz", [[[["foobar", atom]],[a,b,c]]], 2, "froboz", "the end"]]).
["foo","bar","baz","foobar",atom,a,b,c,2,"froboz","the end"]