libretto.examples.supermarket.SupermarketInterface.scala Maven / Gradle / Ivy
The newest version!
package libretto.examples.supermarket
import libretto.scaletto.StarterKit.*
import libretto.examples.supermarket.money.*
trait SupermarketInterface {
type Supermarket
type Shopping[Items]
val goods: GoodsConsumer
import goods.{Beer, ToiletPaper}
given comonoidSupermarket: Comonoid[Supermarket]
given basketReadiness[Items]: Signaling.Positive[Shopping[Items]]
def enterAndObtainBasket: Supermarket -⚬ Shopping[One]
def addBeerToBasket [Items]: Shopping[Items] -⚬ Shopping[Beer |*| Items]
def addToiletPaperToBasket[Items]: Shopping[Items] -⚬ Shopping[ToiletPaper |*| Items]
def payForBeer [Items]: (Coin |*| Shopping[Beer |*| Items]) -⚬ (Beer |*| Shopping[Items])
def payForToiletPaper[Items]: (Coin |*| Shopping[ToiletPaper |*| Items]) -⚬ (ToiletPaper |*| Shopping[Items])
def returnBasketAndLeave: Shopping[One] -⚬ One
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy