Commit ec2e19d8 authored by Jurriën Stutterheim's avatar Jurriën Stutterheim

Update Auction example


git-svn-id: https://svn.cs.ru.nl/repos/iTask-system/trunk@2601 63da3aa8-80fd-4f01-9db8-e6ea747a3da2
parent 411cc00a
module Auction
//:%s/<I\d*, E\d*>\|<\d*>//g
Start = 0
//import iTasks
import iTasks
//:: Bid =
//{ user :: User
//, ware :: String
//, price :: Int
//}
:: Bid =
{ user :: User
, ware :: String
, price :: Int
}
//derive class iTask Bid
derive class iTask Bid
//auction :: (Bid -> Task Bid) User [User] Bid -> Task Bid
//auction bidf auctioneer bidders current =
......@@ -23,8 +25,58 @@ Start = 0
//False -> g bidf auctioneer bidders current
//in g bidf auctioneer bidders current
:: Task a = Task a
auction :: (Bid -> Task Bid) User [User] Bid -> Task Bid
auction bidf auctioneer bidders current =
anyTask [b @: bidf current \\ b <- [auctioneer : bidders]] >>= \newBid ->
case newBid.price > current.price of
True -> (\current -> auction bidf auctioneer bidders current) newBid
False -> case newBid.user == auctioneer of
True -> return current
False -> auction bidf auctioneer bidders current
//auction :: (Bid -> Task Bid) User [User] Bid -> Task Bid
//auction bidf auctioneer bidders current =
//anyTask [ return { Bid | user = auctioneer, ware = "food", price = 42 }
//, return { Bid | user = auctioneer, ware = "food", price = 42 }] >>= \newBid ->
////anyTask [auctioneer @: bidf current, auctioneer @: bidf current] >>= \newBid ->
//case newBid.price > current.price of
//True -> (\current -> auction bidf auctioneer bidders current) newBid
//False -> case newBid.user == auctioneer of
//True -> return current
//False -> auction bidf auctioneer bidders current
//auction :: (Bid -> Task Bid) User [User] Bid -> Task Bid
//auction bidf auctioneer bidders current =
//return { Bid | user = auctioneer, ware = "food", price = 42 } >>= \newBid ->
//case newBid.price > current.price of
//True -> (\current -> auction bidf auctioneer bidders current) newBid
//False -> case newBid.user == auctioneer of
//True -> return current
//False -> auction bidf auctioneer bidders current
//auction :: (Bid -> Task Bid) User [User] Bid -> Task Bid
//auction bidf auctioneer bidders current =
//return { Bid | user = auctioneer, ware = "food", price = 42 } >>= \newBid ->
//case newBid.price > current.price of
//True -> auction bidf auctioneer bidders newBid
//False -> case newBid.user == auctioneer of
//True -> return current
//False -> auction bidf auctioneer bidders current
//auction :: (Bid -> Task Bid) User [User] Bid -> Task Bid
//auction bidf auctioneer bidders current =
//return { Bid | user = auctioneer, ware = "food", price = 42 } >>= \newBid ->
//if (newBid.price > current.price)
//(auction bidf auctioneer bidders newBid)
//(if (newBid.user == auctioneer)
//(return current)
//(auction bidf auctioneer bidders current))
auction :: Task Int
auction = Task 0
//auction :: Task Int
//auction = let x = 1
//in let y = 2
//in return (x + y)
//auction = case True of
//True -> return 1
//False -> return 0
......@@ -698,6 +698,34 @@ OtherModules
ReadableABC: False
ReuseUniqueNodes: True
Fusion: False
Module
Name: Control.Applicative
Dir: {Application}/iTasks-SDK/Server/lib/Platform/OS-Independent
Compiler
NeverMemoryProfile: False
NeverTimeProfile: False
StrictnessAnalysis: True
ListTypes: StrictExportTypes
ListAttributes: True
Warnings: True
Verbose: True
ReadableABC: False
ReuseUniqueNodes: True
Fusion: False
Module
Name: Control.Monad
Dir: {Application}/iTasks-SDK/Server/lib/Platform/OS-Independent
Compiler
NeverMemoryProfile: False
NeverTimeProfile: False
StrictnessAnalysis: True
ListTypes: StrictExportTypes
ListAttributes: True
Warnings: True
Verbose: True
ReadableABC: False
ReuseUniqueNodes: True
Fusion: False
Module
Name: Data.Either
Dir: {Application}/iTasks-SDK/Server/lib/Platform/OS-Independent
......@@ -754,6 +782,20 @@ OtherModules
ReadableABC: False
ReuseUniqueNodes: True
Fusion: False
Module
Name: Data.IO
Dir: {Application}/iTasks-SDK/Server/lib/Platform/OS-Independent
Compiler
NeverMemoryProfile: False
NeverTimeProfile: False
StrictnessAnalysis: True
ListTypes: StrictExportTypes
ListAttributes: True
Warnings: True
Verbose: True
ReadableABC: False
ReuseUniqueNodes: True
Fusion: False
Module
Name: Data.List
Dir: {Application}/iTasks-SDK/Server/lib/Platform/OS-Independent
......
......@@ -11,6 +11,9 @@ clean:
rm -rf "Clean System Files" $(PROJ).exe $(PROJ).prp
debug:
cocl-tonic -P . Auction.icl
cocl-tonic -P . $(PROJ).icl
.PHONY: clean debug default force
rebuild:
make clean && make
.PHONY: clean debug default force rebuild
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment