cab-0.2.1: Distribution/Cab/Utils.hs
module Distribution.Cab.Utils where
import Data.List
-- |
-- >>> fromDotted "1.2.3"
-- [1,2,3]
fromDotted :: String -> [Int]
fromDotted [] = []
fromDotted xs = case break (=='.') xs of
(x,"") -> [read x :: Int]
(x,_:ys) -> (read x :: Int) : fromDotted ys
-- |
-- >>> toDotted [1,2,3]
-- "1.2.3"
toDotted :: [Int] -> String
toDotted = intercalate "." . map show