Supermarket
In a pandemic, supermarkets are required to limit the number of customers in the store. A way to achieve it is to provide a limited number of shopping baskets and require that each customer entering the store has a shopping basket. When there are no more baskets, an incoming customer has to wait for a previous customer to leave (and return their basket).
This example demonstrates:
- concurrency
- customers come and shop concurrently
- sequencing
- a customer can shop only after obtaining a basket
- a customer can use an item only after paying for it
- ...
- mutual exclusion
- limited number of concurrently shopping customers
- without side-effects on shared synchronization objects (such as semaphores)
- limited number of concurrently shopping customers
- linear & session types
- obligation to return a basket enforced before execution
- the type
Shopping
is a protocol between the store and the customer
Type members
Inherited types
final
type BimapSyntax >: ([F[_, _], A, B] =>> BimapSyntax[F, A, B]) <: ([F[_, _], A, B] =>> BimapSyntax[F, A, B])
- Inherited from
- StarterAppBase
final
type FocusedBi >: ([F[_, _], B1, B2] =>> FocusedBi[F, B1, B2]) <: ([F[_, _], B1, B2] =>> FocusedBi[F, B1, B2])
- Inherited from
- StarterAppBase
final
type FocusedOnChoiceCo >: ([F[_], B1, B2] =>> FocusedOnChoiceCo[F, B1, B2]) <: ([F[_], B1, B2] =>> FocusedOnChoiceCo[F, B1, B2])
- Inherited from
- StarterAppBase
final
type FocusedOnChoiceContra >: ([A, F[_], B1, B2] =>> FocusedOnChoiceContra[A, F, B1, B2]) <: ([A, F[_], B1, B2] =>> FocusedOnChoiceContra[A, F, B1, B2])
- Inherited from
- StarterAppBase
final
type FocusedOnDoneTimesCo >: ([F[_], B2] =>> FocusedOnDoneTimesCo[F, B2]) <: ([F[_], B2] =>> FocusedOnDoneTimesCo[F, B2])
- Inherited from
- StarterAppBase
final
type FocusedOnFunctionCo >: ([F[_], A, B] =>> FocusedOnFunctionCo[F, A, B]) <: ([F[_], A, B] =>> FocusedOnFunctionCo[F, A, B])
- Inherited from
- StarterAppBase
final
type FocusedOnFunctionContra >: ([F[_], A, B] =>> FocusedOnFunctionContra[F, A, B]) <: ([F[_], A, B] =>> FocusedOnFunctionContra[F, A, B])
- Inherited from
- StarterAppBase
final
type FocusedOnPairCo >: ([F[_], B1, B2] =>> FocusedOnPairCo[F, B1, B2]) <: ([F[_], B1, B2] =>> FocusedOnPairCo[F, B1, B2])
- Inherited from
- StarterAppBase
final
type FocusedOnPairContra >: ([A, F[_], B1, B2] =>> FocusedOnPairContra[A, F, B1, B2]) <: ([A, F[_], B1, B2] =>> FocusedOnPairContra[A, F, B1, B2])
- Inherited from
- StarterAppBase
final
type FocusedOnPlusCo >: ([F[_], B1, B2] =>> FocusedOnPlusCo[F, B1, B2]) <: ([F[_], B1, B2] =>> FocusedOnPlusCo[F, B1, B2])
- Inherited from
- StarterAppBase
final
type FocusedOnPlusContra >: ([A, F[_], B1, B2] =>> FocusedOnPlusContra[A, F, B1, B2]) <: ([A, F[_], B1, B2] =>> FocusedOnPlusContra[A, F, B1, B2])
- Inherited from
- StarterAppBase
final
type FocusedOnTimesDoneCo >: ([F[_], B1] =>> FocusedOnTimesDoneCo[F, B1]) <: ([F[_], B1] =>> FocusedOnTimesDoneCo[F, B1])
- Inherited from
- StarterAppBase
final
type ValMatcher >: ([U >: V, V, A, R] =>> ValMatcher[U, V, A, R]) <: ([U >: V, V, A, R] =>> ValMatcher[U, V, A, R])
- Inherited from
- StarterAppBase
Value members
Concrete methods
Inherited methods
Extensions
Implicits
Inherited implicits
Exports
Inherited defined exports
final
def relayCompletion[A, B]: Pollable[A] |*| Subscriber[B] -⚬ One |+| Val[A] |*| Pollable[A] |*| Neg[B] |*| Subscriber[B]
Exported from instance.function
- Inherited from
- StarterAppBase
final
def scalaStreams: ScalaStreams[ScalaDSL, CoreLib[ScalaDSL], ScalaLib[ScalaDSL, CoreLib[ScalaDSL]], CoreStreams[ScalaDSL, CoreLib[ScalaDSL]]]
Exported from StarterKit.scalaStreams
- Inherited from
- StarterAppBase