Here is a simple general solution for splitting the list into parts of given lengths and then combining them together with the specified separator:
splitercalate :: [Int] -> [a] -> [a] -> [a]
splitercalate (x:[]) _ s = take x s
splitercalate (x:xs) delim s =
case splitAt x s of
(a, []) -> a
(a, bs) -> a ++ delim ++ splitercalate xs delim bs
In your case, splitercalate [3, 6, 3, 1] "-" $ show 9877342931235will provide you with what you want.
UPDATE: As Antal SZ notes in a comment below, you can implement this function more concisely using functions from Data.Listand Data.List.Split:
splitercalate chunks sep = intercalate sep . splitPlaces chunks
split (, - cabal install split) intercalate splitPlaces:
import Data.List (intercalate)
import Data.List.Split (splitPlaces)
. import split, Antal S-Z's-it .