Re: [Haskell-cafe] Monads with The contexts?

2012-07-19 Thread oleg
http://en.pk.paraiso-lang.org/Haskell/Monad-Gaussian What do you think? Will this be a good approach or bad? I don't think it is a Monad (or even restricted monad, see below). Suppose G a is a `Gaussian' monad and n :: G Double is a random number with the Gaussian (Normal distribution). Then

Re: [Haskell-cafe] Cabal install fails due to recent HUnit

2012-07-19 Thread Simon Hengel
On Wed, Jul 18, 2012 at 05:51:51PM -0600, Richard G. wrote: What's the best way to fix this? I can see two options: - Move the test stanzas to a different Cabal file, allowing users to perform the tests with a little fiddling. - Remove the conditional statements from the test stanzas, which

[Haskell-cafe] Probabilistic programming [Was: Monads with The contexts?]

2012-07-19 Thread oleg
Exercise: how does the approach in the code relate to the approaches to sharing explained in http://okmij.org/ftp/tagless-final/sharing/sharing.html Chapter 3 introduces an implicit impure counter, and Chapter 4 uses a database that is passed around. let_ in Chapter 5 of

Re: [Haskell-cafe] Fwd: hackage compile failure with QuickCheck 2.5

2012-07-19 Thread Ross Paterson
On Wed, Jul 18, 2012 at 09:35:52AM +0100, Erik Hesselink wrote: I don't think you can install this package on 7.4. As Andres said, it requires containers 0.5, but ghc 7.4's base libraries (in this case, template-haskell) use containers 0.4, and can't be reinstalled. I guess your best bet is to

[Haskell-cafe] Need help with learning Parsec

2012-07-19 Thread C K Kashyap
Dear gentle Haskellers, I was trying to whet my Haskell by trying out Parsec today to try and parse out XML. Here's the code I cam up with - I wanted some help with the gettext parser that I've written. I had to do a dummy char ' ') in there just to satisfy the many used in the xml parser. I'd

Re: [Haskell-cafe] Need help with learning Parsec

2012-07-19 Thread Christian Maeder
Am 19.07.2012 14:53, schrieb C K Kashyap: Dear gentle Haskellers, I was trying to whet my Haskell by trying out Parsec today to try and parse out XML. Here's the code I cam up with - I wanted some help with the gettext parser that I've written. I had to do a dummy char ' ') in there just to

Re: [Haskell-cafe] Need help with learning Parsec

2012-07-19 Thread Christian Maeder
Am 19.07.2012 14:53, schrieb C K Kashyap: innerXML = do x - (try xml | gettext) return x Omit try (and return). xml always starts with whereas gettext never does. C. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] Need help with learning Parsec

2012-07-19 Thread Sai Hemanth K
gettext = (many1 $ noneOf ) = (return . Body) works for your case. On Thu, Jul 19, 2012 at 6:37 PM, Christian Maeder christian.mae...@dfki.dewrote: Am 19.07.2012 14:53, schrieb C K Kashyap: Dear gentle Haskellers, I was trying to whet my Haskell by trying out Parsec today to try and

Re: [Haskell-cafe] Need help with learning Parsec

2012-07-19 Thread Christian Maeder
Am 19.07.2012 15:14, schrieb Christian Maeder: Am 19.07.2012 14:53, schrieb C K Kashyap: innerXML = do x - (try xml | gettext) return x Omit try (and return). xml always starts with whereas gettext never does. I was wrong, you do not want to swallow an endTag as

Re: [Haskell-cafe] Need help with learning Parsec

2012-07-19 Thread Simon Hengel
On Thu, Jul 19, 2012 at 06:45:05PM +0530, Sai Hemanth K wrote: gettext = (many1 $ noneOf ) = (return . Body) You can simplify this to: import Control.Applicative hiding ((|)) gettext = Body $ many1 (noneOf ) And some of your other parsers can be simplified as well: innerXML =

Re: [Haskell-cafe] Need help with learning Parsec

2012-07-19 Thread Simon Hengel
gettext = Body $ many1 (noneOf ) Note that this is the same as: gettext = Body `fmap` many1 (noneOf ) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Need help with learning Parsec

2012-07-19 Thread Simon Hengel
On Thu, Jul 19, 2012 at 03:34:47PM +0200, Simon Hengel wrote: openTag :: Parser String openTag = char '' * many (noneOf ) * char '' endTag :: String - Parser String endTag str = string / * string str * char '' Well yes, modified to what Christian Maeder just suggested.

Re: [Haskell-cafe] Need help with learning Parsec

2012-07-19 Thread Christian Maeder
Am 19.07.2012 15:26, schrieb Christian Maeder: Am 19.07.2012 15:14, schrieb Christian Maeder: Am 19.07.2012 14:53, schrieb C K Kashyap: innerXML = do x - (try xml | gettext) return x Omit try (and return). xml always starts with whereas gettext never does. I was wrong,

Re: [Haskell-cafe] How to add constraint to .cabal?

2012-07-19 Thread Brent Yorgey
On Thu, Jul 19, 2012 at 09:37:52AM +0800, Magicloud Magiclouds wrote: Hi, Say I have a package that only appends --constraint=template-haskell==2.7.0.0 --constraint=warp-tls==1.2.1 could I install it. Now I want to release the package, then how could I have these constraint into the .cabal

Re: [Haskell-cafe] Need help with learning Parsec

2012-07-19 Thread Christian Maeder
Am 19.07.2012 15:41, schrieb Simon Hengel: On Thu, Jul 19, 2012 at 03:34:47PM +0200, Simon Hengel wrote: openTag :: Parser String openTag = char '' * many (noneOf ) * char '' if you disallow empty tags and / within tags, then you can avoid the notFollowedBy construct by:

Re: [Haskell-cafe] Need help with learning Parsec

2012-07-19 Thread C K Kashyap
Thank you so much ... I've updated my monad version here - https://github.com/ckkashyap/LearningPrograms/blob/master/Haskell/Parsing/xml_1.hshttps://github.com/ckkashyap/LearningPrograms/blob/master/Haskell/Parsing/xml_2.hs and the Applicative version here -