
-- 전화번호: 숫자만 남기고 (길이, 02 접두) 로 그룹 자릿수를 고른다
groups :: String -> Maybe [Int]
groups ds = case (length ds, "02" `isPrefixOf` ds) of
(11, _) -> Just [3, 4, 4]
(10, True) -> Just [2, 4, 4]
(10, False) -> Just [3, 3, 4]
(9, True) -> Just [2, 3, 4]
_ -> Nothing -- 'Invalid phone number'
format :: String -> Maybe String
format raw = intercalate "-" . splitPlaces' ds <$> groups ds
where ds = filter isDigit raw
-- replace 는 매치된 곳만 바꾸고 나머지는 뒤에 남긴다 → sum groups == length ds 여야 한다
#323 
-- 거리 → 만km. toFixed(1): 반올림하고 0 까지 채운 문자열
formatToManKm :: Double -> String
formatToManKm d = showFFloat (Just 1) (d / 10000) "만km"
formatToManKm 104335 == "10.4만km"
formatToManKm 100000 == "10.0만km" -- 10만km 가 아니다
#325