[Haskell-cafe] Interpreter with Cont

2011-11-22 Thread oleg
I would recommend Ralf Hinze's ICFP00 Pearl Deriving Backtracking Monad Transformers http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.34.4164 He starts with a monad transformer expressed as a free term algebra, and shows step-by-step how to transform it to a more efficient

Re: [Haskell-cafe] Interpreter with Cont

2011-11-21 Thread Ben Franksen
You'll probably get answers from people who are more proficient with this, but here's what I learned over the years. Tim Baumgartner wrote: > Is Cont free as well? No. In fact, free monads are quite a special case, many monads are not free, e.g. the list monad. I believe what David Menendez sai

Re: [Haskell-cafe] Interpreter with Cont

2011-11-21 Thread Tim Baumgartner
2011/11/21 David Menendez > > Here's how you might implement your monad using Cont, > > type InteractionM a b = Cont (Interaction a b) > > exit b = Cont $ \k -> Exit b > output b = Cont $ \k -> Output b (k ()) > input= Cont $ \k -> Input k > runM m = runCont m Exit > That's what I origin

Re: [Haskell-cafe] Interpreter with Cont

2011-11-21 Thread David Menendez
On Mon, Nov 21, 2011 at 2:13 PM, Tim Baumgartner wrote: > Free Monads. It's amazing to be confronted again with notions I learned more > than ten years ago for groups. I have to admit that I'm probably not yet > prepared for a deeper understanding of this, but hopefully I will return to > it later

Re: [Haskell-cafe] Interpreter with Cont

2011-11-21 Thread Tim Baumgartner
Hi Heinrich, I read your article about the operational monad and found it really very enlightening. So I'm curious to work through the material you linked below. Thanks! Regards Tim 2011/11/21 Heinrich Apfelmus > Tim Baumgartner wrote: > >> Thanks a lot! Althaugh I have some understanding of

Re: [Haskell-cafe] Interpreter with Cont

2011-11-21 Thread Tim Baumgartner
Free Monads. It's amazing to be confronted again with notions I learned more than ten years ago for groups. I have to admit that I'm probably not yet prepared for a deeper understanding of this, but hopefully I will return to it later ;-) Is Cont free as well? I guess so because I heard it's someti

Re: [Haskell-cafe] Interpreter with Cont

2011-11-21 Thread Stephen Tetley
On 21 November 2011 14:48, Yves Parès wrote: > I've read Martin Erwig and Steve Kollmansberger's Probabilistic functional > programming in Haskell. > Does someone know if the library they are talking about is available on > hackage? Henning Thielemann has a "batteries included" version on Hackage

Re: [Haskell-cafe] Interpreter with Cont

2011-11-21 Thread Yves Parès
I've read Martin Erwig and Steve Kollmansberger's *Probabilistic functional programming in Haskell*. Does someone know if the library they are talking about is available on hackage? 2011/11/21 Heinrich Apfelmus > Tim Baumgartner wrote: > >> Thanks a lot! Althaugh I have some understanding of the

Re: [Haskell-cafe] Interpreter with Cont

2011-11-21 Thread Heinrich Apfelmus
Tim Baumgartner wrote: Thanks a lot! Althaugh I have some understanding of the Haskell basics and the most important monads, I feel that I have to see more well designed code in order to become a good Haskeller. Can somebody make suggestions what materials are best to work through in order to ach

Re: [Haskell-cafe] Interpreter with Cont

2011-11-20 Thread David Menendez
On Sat, Nov 19, 2011 at 3:29 PM, Felipe Almeida Lessa wrote: > On Sat, Nov 19, 2011 at 6:08 PM, Tim Baumgartner > wrote: >> I have not yet gained a good understanding of the continuation monad, but I >> wonder if it could be used here. What would a clean solution look like? >> Perhaps there are o

Re: [Haskell-cafe] Interpreter with Cont

2011-11-19 Thread Tim Baumgartner
Thanks a lot! Althaugh I have some understanding of the Haskell basics and the most important monads, I feel that I have to see more well designed code in order to become a good Haskeller. Can somebody make suggestions what materials are best to work through in order to achieve this? Are there easy

Re: [Haskell-cafe] Interpreter with Cont

2011-11-19 Thread Felipe Almeida Lessa
On Sat, Nov 19, 2011 at 6:08 PM, Tim Baumgartner wrote: > I have not yet gained a good understanding of the continuation monad, but I > wonder if it could be used here. What would a clean solution look like? > Perhaps there are other things that need to be changed as well? Your 'Interaction' data

[Haskell-cafe] Interpreter with Cont

2011-11-19 Thread Tim Baumgartner
Hi all, I wrote a simple interpreter that can be run in the console: data Interaction a b = Exit b | Output b (Interaction a b) | Input (a -> Interaction a b) runConsole :: Interaction String String -> IO () runConsole (Exit b) = putStrLn $ "Finished