numToken :: Integer -> String -> TokenT
numToken rad ds = Num (toVal ds) (fromInteger rad) (length ds)
  where
  toVal = foldl' (\x c -> rad * x + toDig c) 0
  toDig = if rad == 16 then fromHexDigit else fromDecDigit
numToken :: Integer -> String -> TokenT
numToken rad ds = Num (toVal ds) (fromInteger rad) (length ds)
  where
  toVal = foldl' (\x c -> rad * x + toDig c) 0
  toDig = if rad == 16 then fromHexDigit else fromDecDigit
numToken rad ds = Num (toVal ds) (fromInteger rad) (length ds)
  where
  toVal = foldl' (\x c -> rad * x + toDig c) 0
  toDig = if rad == 16 then fromHexDigit else fromDecDigit