I don't understand why concatMap, rather than simply map, is needed in this:
expand :: [[Int]] -> [[Int]]
expand xs = concatMap (\a -> (map (\b -> a++b) [[1],[2],[3]])) xs
don't a and b each pick up just a simple list in their respective assignments, so that a++b as the concatenation of these lists should be just another list?
Would appreciate some insight ...
aandbhave type[Int]. Can you clarify the actual question? It's hard to answer this. If you don't understand, try to rewriteconcatMap f xsasconcat (map f xs). You will find that the outermost map is producing[[[Int]]].