Re: [Haskell-cafe] Reddy on Referential Transparency

2012-07-28 Thread Neil Davies
Except in the complexity gymnastics and the fragility of the conclusions. Humans can't do large scale complex brain gymnastics - that's why abstraction exists - if your proof process doesn't abstract (and in the C case you need to know *everything* about *everything* and have to prove it all in

[Haskell-cafe] How to define a Monad instance

2012-07-28 Thread Thiago Negri
Hello. I'm trying to understand Monads. In order to do so, I decided to create my own Monad for a simple domain-specific language. The idea is to define a way to describe a multi-value replacement inside do-notation. Example of a function doing what I want (without Monads): replaceAll :: (a -

[Haskell-cafe] MonadPlus m = Maybe a - m a

2012-07-28 Thread Thiago Negri
I'm solving this exercise: http://www.haskell.org/haskellwiki/All_About_Monads#Exercise_4:_Using_the_Monad_class_constraint I'm missing a function to transform a Maybe a into a MonadPlus m = m a. I did search on Hoogle with no luck. There is no standard definition for the g function I'm

Re: [Haskell-cafe] MonadPlus m = Maybe a - m a

2012-07-28 Thread Alexander Solla
On Sat, Jul 28, 2012 at 8:00 AM, Thiago Negri evoh...@gmail.com wrote: I'm solving this exercise: http://www.haskell.org/haskellwiki/All_About_Monads#Exercise_4:_Using_the_Monad_class_constraint I'm missing a function to transform a Maybe a into a MonadPlus m = m a. I did search on Hoogle

Re: [Haskell-cafe] How to define a Monad instance

2012-07-28 Thread Steffen Schuldenzucker
On 07/28/2012 03:35 PM, Thiago Negri wrote: [...] As Monads are used for sequencing, first thing I did was to define the following data type: data TableDefinition a = Match a a (TableDefinition a) | Restart So TableDefinition a is like [(a, a)]. [...] So, to create a replacement table:

Re: [Haskell-cafe] Reddy on Referential Transparency

2012-07-28 Thread Jay Sulzberger
On Sat, 28 Jul 2012, damodar kulkarni kdamodar2...@gmail.com wrote: So a language is referentially transparent if replacing a sub-term with another with the same denotation doesn't change the overall meaning? But then isn't any language RT with a sufficiently cunning denotational semantics?