moduleNumeric.Probability.Example.BarberwhereimportqualifiedNumeric.Probability.Distribution asDistimportNumeric.Probability.Example.Queuing (Time ,System ,unit,evalSystem ,idleAvgP ,waiting )importNumeric.Probability.Percentage (Dist ,RDist ,Trans ,){- no Random instance for Rational type Probability = Rational type Dist a = Dist.T Probability a type RDist a = Rnd.Distribution Probability a type Trans a = Transition Probability a -}-- * barber shopcustServ::Dist Time custServ =Dist.normal [5..10]nextCust::Trans Time -- not dependant on serving timenextCust _=Dist.normal [3..6]barbers::Intbarbers =1customers::Intcustomers =20runs::Intruns =50barberEvent::((),(Dist Time ,Time ->Dist Time ))barberEvent =unit(custServ ,nextCust )barberEvents::[((),(Dist Time ,Time ->Dist Time ))]barberEvents =replicatecustomers barberEvent barberSystem::(Ordb )=>(System ()->b )->RDist b barberSystem eval =evalSystem runs barbers barberEvents eval -- * categorydataCategory =ThreeOrLess |FourToTen |MoreThanTen deriving(Eq,Ord,Show)cat::Time ->Category cat n |n <=3=ThreeOrLess catn |n <=10=FourToTen cat_=MoreThanTen perc::Float->Stringperc n |n <=0.25="0% to 25%"percn |n <=0.5="25% to 50%"percn |n <=0.75="50% to 75%"perc_="75% to 100%"-- * evaluation-- | avg barber idle timebarberIdle::RDist StringbarberIdle =barberSystem (perc .idleAvgP barbers )-- | avg customer waiting time (unserved customers)customerWait::RDist Category customerWait =barberSystem (cat .(`div`customers ).waiting barbers )