Skip to content

Instantly share code, notes, and snippets.

@deque-blog
Created July 1, 2017 13:33
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
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