diff --git a/read_in.py b/read_in.py index f7c79a7..7a91d82 100644 --- a/read_in.py +++ b/read_in.py @@ -36,10 +36,11 @@ def read_single_elevation(dat: str) -> Result[int, str]: >>> read_single_elevation("10.0m") Err('10.0m') """ - return map_res( - meters_to_millimeters, # fuck floating points - try_(replace(dat), float, dat) - ) + try: + # fuck floating points + return Ok(meters_to_millimeters(float(dat))) + except ValueError: + return Err(dat) def read_elevation_line(line: str) -> Result[Sequence[int], Tuple[int, str]]: """ @@ -186,7 +187,7 @@ def load_gb_pixels_as_map(pixels: Iterable[Tuple[int, int]]) -> Result[Sequence[ """ return sequence([ note( - UnrecognizedColor(pix_no % 395, pix_no // 395), + lambda: UnrecognizedColor(pix_no % 395, pix_no // 395), gb_to_terrain_type(gb) ) for (pix_no, gb) in enumerate(pixels)