Skip to content

Instantly share code, notes, and snippets.

@deque-blog
Last active July 4, 2017 16:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deque-blog/d9cbcb80aa1656d064b27b2fe6ad051a to your computer and use it in GitHub Desktop.
Save deque-blog/d9cbcb80aa1656d064b27b2fe6ad051a to your computer and use it in GitHub Desktop.
reserve :: ReservationRequest -> ReservationExpr ReservationResult
reserve request = do
trains <- SearchTrain (_dateTime request) -- Search for trains at date-time
forM trains $ \train -> -- Loop on all the trains
typology <- GetTypology train -- Get the typology of a train
... -- Implement the reservation rules
Log ("Confirming reservation") -- Logging stuff
confirmed <- Request reservation -- Trying to reserve the train
... -- More stuff
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment