parseCommand :: [String] -> (Command, Pos, Pos)
parseCommand s = (command, start, end)
  where (command, rawCoords) = case s of
          ("turn" : "on" : rest) -> (TurnOn, rest)
          ("turn" : "off" : rest) -> (TurnOff, rest)
          ("toggle" : rest) -> (Toggle, rest)
          _ -> error ("invalid command " ++ unwords s)
        (start, end) = parseCoords rawCoords
parseCommand :: [String] -> (Command, Pos, Pos)
parseCommand s = (command, start, end)
  where (command, rawCoords) = case s of
          ("turn" : "on" : rest) -> (TurnOn, rest)
          ("turn" : "off" : rest) -> (TurnOff, rest)
          ("toggle" : rest) -> (Toggle, rest)
          _ -> error ("invalid command " ++ unwords s)
        (start, end) = parseCoords rawCoords
parseCommand s = (command, start, end)
  where (command, rawCoords) = case s of
          ("turn" : "on" : rest) -> (TurnOn, rest)
          ("turn" : "off" : rest) -> (TurnOff, rest)
          ("toggle" : rest) -> (Toggle, rest)
          _ -> error ("invalid command " ++ unwords s)
        (start, end) = parseCoords rawCoords