Re: [Haskell-cafe] Is my code too complicated?

2010-07-05 Thread Yves Parès
About monad transformers, I don't really like to use them because they can get hairy in some cases, and because they have poor performance in other cases. Then what is your alternative? How do you replace monad transformers? ___ Haskell-Cafe

Re: [Haskell-cafe] Is my code too complicated?

2010-07-05 Thread Stephen Tetley
On 5 July 2010 10:39, Yves Parès limestr...@gmail.com wrote: Then what is your alternative? How do you replace monad transformers? Possibly more a case of doing without rather than replacing them with something else, you would amalgamate all the monadic effects you want into one monad. E.g.

[Haskell-cafe] Is my code too complicated?

2010-07-03 Thread Ertugrul Soeylemez
Hello fellow Haskellers, I'd like to discuss an interesting topic. My experience is that there are two worlds in Haskell, which are quite separate: the pure, algorithmic world, where you use idiomatic pure Haskell, and the IO-driven world of state, change, threads and execution, where you use

Re: [Haskell-cafe] Is my code too complicated?

2010-07-03 Thread Ivan Lazar Miljenovic
Ertugrul Soeylemez e...@ertes.de writes: [snip] I fear that my code is already too difficult to understand for beginners, and it's getting worse. But then I ask myself: I've got a powerful language, so why shouldn't I use that power? After all I haven't learnt Haskell to write C code with

Re: [Haskell-cafe] Is my code too complicated?

2010-07-03 Thread Bulat Ziganshin
Hello Ertugrul, Saturday, July 3, 2010, 4:25:22 PM, you wrote: This has proven very useful for me. My usual way is writing monad transformers and sticking them together, often together with concurrent programming. ... /what/ my code is doing, because it's written in natural language as

Re: [Haskell-cafe] Is my code too complicated?

2010-07-03 Thread Felipe Lessa
On Sat, Jul 3, 2010 at 9:25 AM, Ertugrul Soeylemez e...@ertes.de wrote: Haskell provides a lot of low level glue like laziness, currying and other very helpful language features.  But what is different in Haskell is that it doesn't seem to provide any high level glue like other languages do,

Re: [Haskell-cafe] Is my code too complicated?

2010-07-03 Thread Andrew Coppin
Felipe Lessa wrote: Oh, so it is about monad transformers. =) I agree that it gets harder to reason about the code. In fact, sometimes I stack monad transformers in the wrong order. About monad transformers, I don't really like to use them because they can get hairy in some cases, and

Re: [Haskell-cafe] Is my code too complicated?

2010-07-03 Thread Stephen Tetley
On 3 July 2010 14:20, Andrew Coppin andrewcop...@btinternet.com wrote: Tangentally, it seems to me that all monads can be described as doing zero or more of: - Invisibly pass state around (and possibly modify it). - Perform unusual flow control. - I/O (or some restricted subset of it). Can

Re: [Haskell-cafe] Is my code too complicated?

2010-07-03 Thread Ivan Lazar Miljenovic
Stephen Tetley stephen.tet...@gmail.com writes: On 3 July 2010 14:20, Andrew Coppin andrewcop...@btinternet.com wrote: Tangentally, it seems to me that all monads can be described as doing zero or more of: - Invisibly pass state around (and possibly modify it). - Perform unusual flow

Re: [Haskell-cafe] Is my code too complicated?

2010-07-03 Thread Claus Reinke
Most languages today provide a certain glue to bring everything together. Most languages today provide several kinds of glue and, while some of those kinds are not recommended, Haskell unfortunately doesn't provide all useful kinds of glue. Especially the module system is a weak point: in SML,

Re: [Haskell-cafe] Is my code too complicated?

2010-07-03 Thread Andrew Coppin
Ivan Lazar Miljenovic wrote: Stephen Tetley stephen.tet...@gmail.com writes: On 3 July 2010 14:20, Andrew Coppin andrewcop...@btinternet.com wrote: Tangentally, it seems to me that all monads can be described as doing zero or more of: - Invisibly pass state around (and possibly

Re: [Haskell-cafe] Is my code too complicated?

2010-07-03 Thread Andrew Coppin
Stephen Tetley wrote: On 3 July 2010 14:20, Andrew Coppin andrewcop...@btinternet.com wrote: Tangentally, it seems to me that all monads can be described as doing zero or more of: - Invisibly pass state around (and possibly modify it). - Perform unusual flow control. - I/O (or some

Re: [Haskell-cafe] Is my code too complicated?

2010-07-03 Thread Stephen Tetley
On 3 July 2010 15:04, Andrew Coppin andrewcop...@btinternet.com wrote: I said does something that doesn't fall under one of these. The identity monad, by contrast, does nothing that does fall under these. :-P (It falls under zero of these.) Okay, how about: The probability monad The