No description or website provided.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


- Lambda Lounge Vending Machine
- Created by Aditya Siram
--- Contents ---
- Overview
- Usage
- Sample Run

--- Overview ---
This program implements in Haskell the vending machine specified by the Lambda Lounge shootout [1] in May 2009. To make life more interesting, it as a multi-user vending machine that is restocked and services requests real-time over telnet. I did this to explore Haskell's Software Transactional Memory [2].

The included binary runs only on Linux i386/i686 machines.

--- Usage ---
1. Run the 'VendingMachine' binary included in this directory from a shell prompt to start the server:
> ./VendingMachine

2. To start a client telnet to port 8000 of the server machine. In the case that the server and client are on the same machine:
> telnet localhost 8000

-- Sample Run --
User commands are prefixed with '>', comments to guide you thorough the process are prefixed with '--'.

Connected to localhost.
Escape character is '^]'.
--show how to interact with the machine
> help 
-Available Commands:
  insert <Money>
  show balance | candystock | moneystock
  restockMoney <Money> 
  restockCandy <Candy>
  buy <Candy>

-- Add money to your cache. You now have $2.35 in your cache
> show balance
> insert dollar dollar quarter
> insert dime
> show balance

-- Show the candy stock, in this case there
-- are 7 "Dollar" candies etc.
> show candystock
[(Item "SixtyFive",10),(Item "Dollar",7),(Item "BuckFifty",9)]

-- Try to buy something without enough money. Note you can 
-- only buy one candy at a time. Transaction like,
-- > buy buckfifty dollar
-- are not supported.
> buy buckfifty
More Money

-- Add some more money and try again. Assume you have the candy when
-- the machine dispenses change. Below, for instance, your leftover 
-- cache from buying "BuckFifty" which costs $1.50 is a dollar and a
-- dime. You can then use this to buy "SixtyFive" which costs $0.65 
-- giving leaving a quarter and two dimes
> insert quarter
> buy buckfifty
> buy sixtyfive

-- You can also restock the vending machine
> show moneystock
> restockMoney quarter dime
> show moneystock
> show candystock
[(Item "BuckFifty",8),(Item "Dollar",7),(Item "SixtyFive",9)]
> restockCandy dollar
> show candystock
[(Item "BuckFifty",8),(Item "Dollar",8),(Item "SixtyFive",9)]

--And you can quit!
> quit
Connection closed by foreign host.