Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
evalReservation :: ReservationExpr ty -> IO ty
evalReservation = evalCmd
where
evalCmd :: ReservationExpr ty -> IO ty
evalCmd (Log msg) = putStrLn msg
evalCmd (Pure val) = pure val
evalCmd (Bind val next) = evalCmd val >>= evalCmd . next
evalCmd (SearchTrain time) = searchTrainAt time
evalCmd (GetTypology trainId) = getTypologyOf trainId
evalCmd (Reserve command) = confirmCommand command
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment