F3PSUKWXAFKSWPWD4OFGDMMOPGRZVLJWWHNWOHRDP677PZVFTRIQC input <- readInput "Income: " (readEither @Int)case input ofLeft x -> liftIO $ hPutStrLn stderr ("An error occurred: " ++ show x)Right x -> docase calculateBudget x ofLeft e -> liftIO $ hPutStrLn stderr ("An error occured: " ++ show e)Right x -> liftIO $ print x
income <- readInput "Income: " (readEither @Int)budget <- calculateBudget incomeliftIO $ print budget
mkIncome :: Int -> Either AppError (PosMoney "USD")mkIncome input = mapLeft (const NegativeIncome) $ eitherPos input >>= return . PosMoney @"USD"
mkIncome :: Int -> App (PosMoney "USD")mkIncome input = liftEither . mapLeft (const NegativeIncome) $ eitherPos input >>= return . PosMoney @"USD"