version :: String -> Maybe Version
version s = case vparts s of
    ([], _)                         -> Nothing
    ([m], x) | m >= 600 && m < 800  -> Just $ let (a, b) = m `divMod` 100 in
                                                    Version [a, b] x
             | otherwise            -> Nothing
        -- some old versions were installed in directories named "610" and "612"
    (ns, x)                         -> Just $ Version ns x
  where
    vparts s' = case span isDigit s' of
        ("", x) -> ([], x)
        (n, ('.':r)) -> let (m, x) = vparts r in (read n:m, x)
        (n, x) -> ([read n], x)
version :: String -> Maybe Version
version s = case vparts s of
    ([], _)                         -> Nothing
    ([m], x) | m >= 600 && m < 800  -> Just $ let (a, b) = m `divMod` 100 in
                                                    Version [a, b] x
             | otherwise            -> Nothing
        -- some old versions were installed in directories named "610" and "612"
    (ns, x)                         -> Just $ Version ns x
  where
    vparts s' = case span isDigit s' of
        ("", x) -> ([], x)
        (n, ('.':r)) -> let (m, x) = vparts r in (read n:m, x)
        (n, x) -> ([read n], x)
version s = case vparts s of
    ([], _)                         -> Nothing
    ([m], x) | m >= 600 && m < 800  -> Just $ let (a, b) = m `divMod` 100 in
                                                    Version [a, b] x
             | otherwise            -> Nothing
        -- some old versions were installed in directories named "610" and "612"
    (ns, x)                         -> Just $ Version ns x
  where
    vparts s' = case span isDigit s' of
        ("", x) -> ([], x)
        (n, ('.':r)) -> let (m, x) = vparts r in (read n:m, x)
        (n, x) -> ([read n], x)