Skip to content

Instantly share code, notes, and snippets.

@amitaibu
Created December 23, 2017 18:39
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 amitaibu/abcea7a114b213df48689e662a58f79d to your computer and use it in GitHub Desktop.
Save amitaibu/abcea7a114b213df48689e662a58f79d to your computer and use it in GitHub Desktop.
Excerpt of Item's status
{-| These are the the states of an open item. You will notice there is a state
called `GoneTranstion` which exists under the Open. This state is a special case
that really exists only as a transition state. That is, when we want to finish
the sale of an item we cannot decide ourself it it's "sold" or "unsold" - that
is the responsibility of the server. So we will send the server a `gone` request,
which will be later decided if the item is sold or not.
So a `GoneTransition` is a very temporarye state, for until we are clear on the `SoldStatus`.
This also works the other way around. That is, when we are in `ItemClosed` state, the clerk
may still go back to `Going` or `Open` in case there was some mistake or a bid was
placed in the room in the right time.
-}
type OpenStatus
= Open
| Going
| GoneTransition
type SoldStatus
= Sold
| Unsold
type EditableItemStatus
= LiveOnly (EditableWebData OpenStatus)
-- Live sale has not started, or is paused.
| MailOnly (EditableWebData OpenStatus)
type ReadOnlyItemStatus
= ItemClosed SoldStatus
| SaleNotStarted
| SaleClosed
| Withdrawn
| ItemNotActiveButAlreadyHasLiveBids
{-| The item status can be either open for bidding or not. We keep the exact
reason to why it could be closed.
-}
type Status
= EditableStatus EditableItemStatus
| ReadOnlyStatus ReadOnlyItemStatus
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment