Re: [Haskell] Discrete event simulation
- Original Message - From: "Jake Luck" <[EMAIL PROTECTED]> To: Sent: Friday, January 27, 2006 7:41 AM Subject: Re: [Haskell] Discrete event simulation Part of this will be some kind of synchronisation primitive. I don't much care what it is, but somewhere I need a way to make a process wait until something happens rather than just a constant time. Paul, what you have described sounds like a reactive system. Have you looked into AFRP/Yampa? Although it is based on a continuous time model simulation, it might just work for your scenario nicely. jake There's a Yampa-like arrow for DES described in my notes at the AFP Summer School 2004. It's a small example, not optimised at all, but might still be useful. Unlike Yampa, time is discrete and arrows compute only when there is something for them to do. John ___ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell
Re: [Haskell] Discrete event simulation
Part of this will be some kind of synchronisation primitive. I don't much care what it is, but somewhere I need a way to make a process wait until something happens rather than just a constant time. Paul, what you have described sounds like a reactive system. Have you looked into AFRP/Yampa? Although it is based on a continuous time model simulation, it might just work for your scenario nicely. jake ___ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell
Re: [Haskell] Discrete event simulation
I don't have an answer. But I do have questions which may help. Paul Johnson wrote: > Hi, I'm going slowly nuts here. Maybe someone can help me out. You could also try the IRC channel #haskell on freenode.irc.net > > I want to do some fairly straightforward discrete event simulation. But I do not know your terms, so I will ask you about them. > Tasks do side effects, probably in the ST monad. Every so often the > current task calls "delay n" where n is a number of seconds. This puts > the task back on a list of schedulable processes that is ordered by > time, and then takes the head of the list and starts executing it. So side effects means setting STRef's or ST(U)Arrays. "delay n" means simulated seconds or wall clock seconds? Also tasks are sounding like threads...Could you define event and task and scheduler for us? How many events or tasks are there? How does the scheduler interact with the events or tasks? > Part of this will be some kind of synchronisation primitive. I don't > much care what it is, but somewhere I need a way to make a process wait > until something happens rather than just a constant time. Is a task is polling: calling "delay n" over and over again, checking for something interesting each time? If you are not in ST, then you can be in STM or IO and have a task in a thread that will block waiting for a TMVar or an MVar (or a QSem), which represents something interesting happening. The forkIO threads are really cheap, and STM is very cool if the optimistic assumption is valid. > I think I want to use something like > > type Task r s a = ContT r (ST s) a > > But I can't see how to actually do it. I've read All About Monads. > I've googled for anything to do with continuations and coroutines. I'm > stuck. Can someone show me how to do it. Now continuations and a scheduler sounds like the Zipper-base file server/OS: http://lambda-the-ultimate.org/node/1036 That code uses partial continuations to manage tasks that talk to a scheduler. The code is quite short and it knows more than I do. > > Thanks, > > Paul. > Good Luck, Chris ___ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell
[Haskell] Discrete event simulation
Hi, I'm going slowly nuts here. Maybe someone can help me out. I want to do some fairly straightforward discrete event simulation. Tasks do side effects, probably in the ST monad. Every so often the current task calls "delay n" where n is a number of seconds. This puts the task back on a list of schedulable processes that is ordered by time, and then takes the head of the list and starts executing it. Part of this will be some kind of synchronisation primitive. I don't much care what it is, but somewhere I need a way to make a process wait until something happens rather than just a constant time. I think I want to use something like type Task r s a = ContT r (ST s) a But I can't see how to actually do it. I've read All About Monads. I've googled for anything to do with continuations and coroutines. I'm stuck. Can someone show me how to do it. Thanks, Paul. ___ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell
Re: [Haskell] Discrete event simulation
> I'm wondering if there is work done about discrete event simulation in > functional languages, and more specifically, Haskell DSLs. Any pointers? Check out Yampa: http://haskell.org/yampa/ /Niklas ___ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell
Re: [Haskell] Discrete event simulation
Hello Bruno, Monday, May 30, 2005, 3:13:08 AM, you wrote: BMA> I'm wondering if there is work done about discrete event simulation in BMA> functional languages, and more specifically, Haskell DSLs. Any pointers? FP language Erlang was created especially to program phone exchanges which is close to your area - but it is about dealing with real events instead of simulating. it is better than Haskell in creating distributed net of processes which send events to each other on the other side, you can emulate your objects via Haskell threads and use Chan'nels to send events between them -- Best regards, Bulatmailto:[EMAIL PROTECTED] ___ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell
[Haskell] Discrete event simulation
Hi. I'm wondering if there is work done about discrete event simulation in functional languages, and more specifically, Haskell DSLs. Any pointers? Regards, Bruno MartÃnez Conectese mas rapido y ahorre hasta un 50% Tel. 0909.2030 => $0,15 IVA incluido el minuto __ http://www.internet.com.uy - En Uruguay somos internet Conectese mas rapido y ahorre hasta un 50% Tel. 0909.2030 => $0,15 IVA incluido el minuto __ http://www.internet.com.uy - En Uruguay somos internet ___ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell