[Haskell-cafe] Capturing the parent element as I parse XML using parsec

2012-07-28 Thread C K Kashyap
Hi, With the help of the cafe I've been able to write up the xml parser using parsec - https://github.com/ckkashyap/really-simple-xml-parser/blob/master/RSXP.hs I am struggling with an idea though - How can I capture the parent element of each element as I parse? Is it possible or would I have to

Re: [Haskell-cafe] Reddy on Referential Transparency

2012-07-28 Thread Jay Sulzberger
On Sat, 28 Jul 2012, damodar kulkarni 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? Or even a dumb one tha

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] MonadPlus m => Maybe a -> m a

2012-07-28 Thread Alexander Solla
On Sat, Jul 28, 2012 at 8:00 AM, Thiago Negri 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 with no luck

[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 defini

[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 -> M

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 i