-- Reads the expansion rules from the arg strings.
readExps :: [String] -> Map.Map Char String
readExps = Map.fromList . readExps'
  where
    readExps' [] = []
    readExps' (x:xs)
      | length x >= 3 && take 2 (tail x) == "->" =
          (head x, drop 3 x) : readExps' xs
      | otherwise = readExps' xs

-- Reads the color map from the arg strings. Ugly hex stuff.
readExps :: [String] -> Map.Map Char String
readExps = Map.fromList . readExps'
  where
    readExps' [] = []
    readExps' (x:xs)
      | length x >= 3 && take 2 (tail x) == "->" =
          (head x, drop 3 x) : readExps' xs
      | otherwise = readExps' xs

-- Reads the color map from the arg strings. Ugly hex stuff.
readExps = Map.fromList . readExps'
  where
    readExps' [] = []
    readExps' (x:xs)
      | length x >= 3 && take 2 (tail x) == "->" =
          (head x, drop 3 x) : readExps' xs
      | otherwise = readExps' xs

-- Reads the color map from the arg strings. Ugly hex stuff.