isValid :: String -> Bool
isValid phone = validLength && validArea && validExchange
  where
    validLength = length phone == 10
    validArea = validSubCode $ head phone
    validExchange = validSubCode $ phone !! 3
    validSubCode = (`elem` ['2'..'9'])
isValid :: String -> Bool
isValid phone = validLength && validArea && validExchange
  where
    validLength = length phone == 10
    validArea = validSubCode $ head phone
    validExchange = validSubCode $ phone !! 3
    validSubCode = (`elem` ['2'..'9'])
isValid phone = validLength && validArea && validExchange
  where
    validLength = length phone == 10
    validArea = validSubCode $ head phone
    validExchange = validSubCode $ phone !! 3
    validSubCode = (`elem` ['2'..'9'])