Re: [Haskell-cafe] overloading show function

2011-06-30 Thread Holger Siegel
Am 29.06.2011 um 23:50 schrieb Philipp Schneider: Hi cafe, in my program i use a monad of the following type newtype M a = M (State - (a, State)) i use the monad in two different ways. The type variable a can be a pair as in interp :: Term - Environment - M (Value,Environment)

Re: [Haskell-cafe] overloading show function

2011-06-30 Thread Wolfgang Braun
An environment contains local variable bindings, so no subcomputation will ever need to return its environment. - That is not true. A subcomputation can possible modify an environment except the language forbids such a case. On 06/30/2011 02:36 PM, Holger Siegel wrote: Am 29.06.2011 um

Re: [Haskell-cafe] overloading show function

2011-06-30 Thread Philipp Schneider
On 06/30/2011 02:36 PM, Holger Siegel wrote: Am 29.06.2011 um 23:50 schrieb Philipp Schneider: Hi cafe, in my program i use a monad of the following type newtype M a = M (State - (a, State)) i use the monad in two different ways. The type variable a can be a pair as in interp :: Term -

Re: [Haskell-cafe] overloading show function

2011-06-30 Thread Philipp Schneider
On 06/30/2011 08:25 PM, Philipp Schneider wrote: On 06/30/2011 02:36 PM, Holger Siegel wrote: Am 29.06.2011 um 23:50 schrieb Philipp Schneider: Hi cafe, in my program i use a monad of the following type newtype M a = M (State - (a, State)) i use the monad in two different ways. The type

Re: [Haskell-cafe] overloading show function

2011-06-30 Thread Holger Siegel
Am 30.06.2011 um 20:23 schrieb Philipp Schneider: On 06/30/2011 02:36 PM, Holger Siegel wrote: Am 29.06.2011 um 23:50 schrieb Philipp Schneider: Hi cafe, in my program i use a monad of the following type newtype M a = M (State - (a, State)) i use the monad in two different ways.

Re: [Haskell-cafe] overloading show function

2011-06-30 Thread Philipp Schneider
On 06/30/2011 09:49 PM, Holger Siegel wrote: Am 30.06.2011 um 20:23 schrieb Philipp Schneider: On 06/30/2011 02:36 PM, Holger Siegel wrote: Am 29.06.2011 um 23:50 schrieb Philipp Schneider: Hi cafe, in my program i use a monad of the following type newtype M a = M (State - (a, State))

Re: [Haskell-cafe] overloading show function

2011-06-30 Thread Holger Siegel
Am 30.06.2011 um 22:57 schrieb Philipp Schneider: On 06/30/2011 09:49 PM, Holger Siegel wrote: (...) But that won't work: After you have evaluated an entry of the environment, you store the resulting value but you throw away its updated environment. That means, you lose the results of all

Re: [Haskell-cafe] overloading show function

2011-06-30 Thread Philipp Schneider
On 06/30/2011 11:46 PM, Holger Siegel wrote: Am 30.06.2011 um 22:57 schrieb Philipp Schneider: On 06/30/2011 09:49 PM, Holger Siegel wrote: (...) But that won't work: After you have evaluated an entry of the environment, you store the resulting value but you throw away its updated

[Haskell-cafe] overloading show function

2011-06-29 Thread Philipp Schneider
Hi cafe, in my program i use a monad of the following type newtype M a = M (State - (a, State)) i use the monad in two different ways. The type variable a can be a pair as in interp :: Term - Environment - M (Value,Environment) and it can be just a value as in type Environment = [(Name,

Re: [Haskell-cafe] overloading show function

2011-06-29 Thread aditya siram
Try enabling OverlappingInstances extension by adding this to the top of the file: {-# LANGUAGE OverlappingInstances #-} -deech On Wed, Jun 29, 2011 at 4:50 PM, Philipp Schneider philipp.schneid...@gmx.net wrote: Hi cafe, in my program i use a monad of the following type newtype M a = M

Re: [Haskell-cafe] overloading show function

2011-06-29 Thread Steffen Schuldenzucker
Hi Philipp, On 06/29/2011 11:50 PM, Philipp Schneider wrote: Hi cafe, in my program i use a monad of the following type newtype M a = M (State - (a, State)) btw., it looks like you just rebuilt the State monad. ... instance (Show a,Show b) = Show (M (a,b)) where show (M f) = let

Re: [Haskell-cafe] overloading show function

2011-06-29 Thread Philipp Schneider
Thank you very much, this worked. On 06/30/2011 12:03 AM, aditya siram wrote: Try enabling OverlappingInstances extension by adding this to the top of the file: {-# LANGUAGE OverlappingInstances #-} -deech On Wed, Jun 29, 2011 at 4:50 PM, Philipp Schneider philipp.schneid...@gmx.net