Re: [Haskell-cafe] Interleaving type variables in a tree, has this a name ?

2012-10-14 Thread Eric Dedieu
data ANode a b = ANode a [BNode a b] [BNode a b] data BNode a b = BNode b [ANode a b] [ANode a b] Wouldn't the following work as well and be simpler to handle : data Node a b = Node a [Node b a] [Node b a] Yes ! In fact my actual structure is not symmetrical (some lists must preserve order

[Haskell-cafe] Interleaving type variables in a tree, has this a name ?

2012-10-13 Thread Eric Dedieu
Hi Haskell Helpers, For a hobby projet to learn haskell, I'm trying to use this kind of interleaved tree structure (simplified): data ANode a b = ANode a [BNode a b] [BNode a b] data BNode a b = BNode b [ANode a b] [ANode a b] The first list of each node is for links up, the second for down.

Re: [Haskell-cafe] Help mixing pure and IO code

2009-11-30 Thread Eric Dedieu
There's a nice approach to this problem which is described and implemented in the MonadPrompt package[1]. Thanks a lot for this link. The guessing game example linked to from the documentation is still very hard to understand (I'm still struggling with monads), but it seems to fill my needs.

Re: [Haskell-cafe] Help mixing pure and IO code

2009-11-30 Thread Eric Dedieu
Still more importantly to me, I understand that anyhow if I intend to use IO or random numbers, I must design my strategy from the beginning as encapsulated in a monad. Something like: class (Monad m) = Strategy m a where ... That's not true at all, you can always pass this data

Re: [Haskell-cafe] GHCi infers a type but refuses it as type signature

2009-06-23 Thread Eric Dedieu
Thanks for your answers. I still have a question, though... I think the reasoninging here is the following: If MonadState is part of the standard library and it needs this extension to work, then all compilers must support this extension. Yes, exactly, that was my point. I'm not completely