[Haskell-cafe] ANNOUNCE xml-conduit-generic

2013-03-12 Thread Dmitry Olshansky
Hello, cafe! I made a package xml-conduit-generichttps://github.com/odr/xml-conduit-generic to provide conversion from ADT to xml and vice versa. Conversion works as Conduit (ToXml) or Consumer (FromXml). Example: data T4 = T4 {v4 :: Int, n4 :: Maybe T4} deriving (Eq, Show, Generic) instance

Re: [Haskell-cafe] Parser left recursion

2013-02-20 Thread Dmitry Olshansky
Did you see expression parser in parsec packagehttp://hackage.haskell.org/packages/archive/parsec/3.1.3/doc/html/Text-Parsec-Expr.html? Is it not enough? 2013/2/20 Martin Drautzburg martin.drautzb...@web.de Hello all, this was previously asked on haskell-beginners, but only partially

Re: [Haskell-cafe] I killed performance of my code with Eval and Strategies

2012-11-16 Thread Dmitry Olshansky
Just another definition of calculateSeq: calculateSeq = zipWith ($) (cycle [sin,cos]) . map sqrt 2012/11/15 Janek S. fremenz...@poczta.onet.pl Do you really mean to calculate the 'sin . sqrt' of just the head of the list, or do you mean: calculateSeq = map (sin . sqrt) ? Argh.. of

Re: [Haskell-cafe] Maximum bipartite matching: 24 lines

2012-10-29 Thread Dmitry Olshansky
I didn't analyze it but anytime I see M.insertWith I am just in doubt - do you know about a strict version M.insertWith' ? 2012/10/24 Stefan Klinger all-li...@stefan-klinger.de On 2012-Oct-22 14:23 (-0700), Eugene Kirpichov wrote with possible deletions: fwd = foldr (\(x,y) -

Re: [Haskell-cafe] Data.Text and quasi quoting

2012-10-02 Thread Dmitry Olshansky
Hello, if you change from test2 = [expr| test |] to test2 = [expr| $test |] then it will be compile. Do you want that or what? 2012/10/2 Jake Wheat jakewheatm...@gmail.com Hello, I have a parser which parses to an ast which contains Text values. I am trying to use this parser with

Re: [Haskell-cafe] not enough fusion?

2012-06-25 Thread Dmitry Olshansky
s1 ~ sum $ map (sum . flip map [0..n] . gcd) [0..n] s2 ~ sum $ concatMap (flip map [0..n] . gcd) [0..n] There are some posts from Joachim Breitner investigated fusion for concatMap: http://www.haskell.org/pipermail/haskell-cafe/2011-December/thread.html#97227 2012/6/25 Johannes Waldmann

Re: [Haskell-cafe] not enough fusion?

2012-06-25 Thread Dmitry Olshansky
]] From the links posted by Dmitry, it might be that the code generated is made of 2 recursive calls: in fact, what I observe is a stack space overflow error on runtime... L. On Mon, Jun 25, 2012 at 10:09 AM, Dmitry Olshansky olshansk...@gmail.comwrote: s1 ~ sum $ map (sum . flip map [0

Re: [Haskell-cafe] Guide for converting existing code to Conduit 0.4?

2012-04-09 Thread Dmitry Olshansky
I transfered my code from 0.3 to 0.4 without any changes. There are type synonyms in Conduit for that. Changes were from 0.2 to 0.3. Michael discribed it here http://www.yesodweb.com/blog/2012/03/announcing-conduit-0-3 Actually, in 0.4 no changes with Control.Monad.Trans.Resource. type Source m

Re: [Haskell-cafe] is the evaluation order deterministic when using applicative with IO

2012-03-16 Thread Dmitry Olshansky
As usual you can check: Prelude Control.Applicative pure (||) * pure True * undefined *** Exception: Prelude.undefined Prelude Control.Applicative (||) True undefined True 2012/3/16 Rouan van Dalen rvda...@yahoo.co.uk Hi everyone. I was wondering if I can make assumptions about the

Re: [Haskell-cafe] Empty Input list

2012-03-13 Thread Dmitry Olshansky
Look also at safe package http://hackage.haskell.org/package/safe 2012/3/13 Chris Wong chrisyco+haskell-c...@gmail.com On Tue, Mar 13, 2012 at 12:24 PM, Chris Smith cdsm...@gmail.com wrote: On Mon, Mar 12, 2012 at 3:14 PM, Kevin Clees k.cl...@web.de wrote: Now my function looks like this:

Re: [Haskell-cafe] need help with monad transformers

2012-03-01 Thread Dmitry Olshansky
If I'm running register outside runWriterT everything will work. Maybe just lift $ register $ print freed2 or I didn't catch something? 2012/3/1 Alexander V Vershilov alexander.vershi...@gmail.com Hello. I'm trying to add monad stack into network-conduit, and everything works except

Re: [Haskell-cafe] need help with monad transformers

2012-03-01 Thread Dmitry Olshansky
. 2012/3/2 Alexander V Vershilov alexander.vershi...@gmail.com I've found a solution, I should not use lift for runWriterT, and should explicilty lift all computation of level I need, i.e. (lift.lift) for ask and lift for register. Thu, Mar 01, 2012 at 02:19:29PM +0400, Dmitry Olshansky wrote

[Haskell-cafe] Fwd: XML modification

2011-11-23 Thread Dmitry Olshansky
Personally I prefer xml-enumerator. You can work with xml-stream or with DOM through cursor (like XPath). I think that in your case working with stream is preferrable. You can just make an Enumeratee like import qualified Data.Enumerator.List as EL myEnum = EL.map f where f

Re: [Haskell-cafe] Is it possible to get the information of instances of a type?

2011-11-07 Thread Dmitry Olshansky
For TH look also at http://www.mail-archive.com/haskell-cafe@haskell.org/msg13057.html 2011/10/27 Magicloud Magiclouds magicloud.magiclo...@gmail.com On Thu, Oct 27, 2011 at 1:57 AM, Brent Yorgey byor...@seas.upenn.edu wrote: On Wed, Oct 26, 2011 at 09:10:23PM +0400, MigMit wrote: Can't

Re: [Haskell-cafe] Enumerators, Enumeratees and Iterators

2011-06-28 Thread Dmitry Olshansky
Hi, for the first question you can look at combinators in Data.Iteratee.ListLikehttp://hackage.haskell.org/packages/archive/iteratee/0.8.5.0/doc/html/Data-Iteratee-ListLike.html for iteratee package or

Re: [Haskell-cafe] Enumerators, Enumeratees and Iterators

2011-06-28 Thread Dmitry Olshansky
If I've understood it correctly, concurrent is similar to functions discussed here: http://www.haskell.org/pipermail/haskell-cafe/2011-April/091474.html and here http://www.haskell.org/pipermail/haskell-cafe/2011-January/088319.html 2011/6/28 Ertugrul Soeylemez e...@ertes.de Sævar Berg

Re: [Haskell-cafe] GHC 7.0.3 / Win32: Data.Time library?

2011-06-14 Thread Dmitry Olshansky
Could you look at http://hackage.haskell.org/packages/archive/time/1.2.0.5/doc/html/Data-Time-Format.html ? Is it enough? 2011/6/14 Dmitri O.Kondratiev doko...@gmail.com Sorry for typo - I need subtract dates (no 'abstracting') : On Tue, Jun 14, 2011 at 3:49 PM, Dmitri O.Kondratiev

[Haskell-cafe] Oracle Sessions in Takusen

2011-06-01 Thread Dmitry Olshansky
Hello, Could anyone explain strange behavior of Takusen with OracleDB (OraClient 11.x)? Several sequential sessions give Seqmentation Fault error. In case of nested sessions it works well. {-# LANGUAGE ScopedTypeVariables #-} module Main where import Database.Oracle.Enumerator import

Re: [Haskell-cafe] Iteratee: manyToOne

2011-04-29 Thread Dmitry Olshansky
Thank you! Working implementation is even more than I've expected. 2011/4/28 Felipe Almeida Lessa felipe.le...@gmail.com On Thu, Apr 28, 2011 at 1:10 PM, Felipe Almeida Lessa felipe.le...@gmail.com wrote: On Thu, Apr 28, 2011 at 12:09 PM, Felipe Almeida Lessa felipe.le...@gmail.com

Re: [Haskell-cafe] Iteratee: manyToOne

2011-04-29 Thread Dmitry Olshansky
In my case leftover is not important. But in common case... Just an idea... What if we provide iterWhile :: Iteratee a m () - Iteratee a m b - Iteratee a m b The first Iteratee only control when the result should be yeilded and feed an input to second Iteratee. Then we can change manyToOne to

[Haskell-cafe] Iteratee: manyToOne

2011-04-28 Thread Dmitry Olshansky
Hello, does somewhere exist function with type like this - manyToOne :: [Iteratee a m b] - Iteratee a m [b] ? I.e. I need to process one input through many Iteratees indepentently in constant space and collect results. It is similar by type with sequenceM but as far as I understand sequenceM

[Haskell-cafe] Fwd: using IO monad in Iteratee

2011-04-02 Thread Dmitry Olshansky
-- Forwarded message -- From: Dmitry Olshansky olshansk...@gmail.com Date: 2011/4/2 Subject: Re: [Haskell-cafe] using IO monad in Iteratee To: wren ng thornton w...@freegeek.org Well, in my case I can use probably withBinaryFile fn (\h- run $ enumHandle h ...) 2011/4/2 wren

Re: [Haskell-cafe] using IO monad in Iteratee

2011-04-02 Thread Dmitry Olshansky
Very interesting, thanks. I didn't feel your classes yet... Do you think that provide these instances for Iteratee is possible? 2011/4/2 Bas van Dijk v.dijk@gmail.com On 1 April 2011 21:59, Dmitry Olshansky olshansk...@gmail.com wrote: Is it possible to change enumFile to using MonadIO

Re: [Haskell-cafe] using IO monad in Iteratee

2011-04-02 Thread Dmitry Olshansky
, Dmitry Olshansky olshansk...@gmail.com wrote: Is it possible to change enumFile to using MonadIO class? No because it uses the control operation Control.Exception.finally :: IO a - IO b - IO a internally. You can't lift control operations with liftIO :: MonadIO m = IO a - m a. However

[Haskell-cafe] using IO monad in Iteratee

2011-04-01 Thread Dmitry Olshansky
Dear collegues, I use Iteratee with Monad Transformer stack in this way: type MyMonad a b = Iteratee a (StateT StateType IO) b I've wrote some Enumeratees using this type. Then I want to compose it with standard enumerator like Data.Enumerator.Binary.enumFile. But enumFile use IO monad instead

[Haskell-cafe] fetching BLOBs

2011-02-07 Thread Dmitry Olshansky
Hello, cafe, Is there a way to get BLOB fields from OracleDB using Takusen? What about other possibilities (through HDBC - ODBC)? Dima ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Takusen and QuickCheck

2011-01-26 Thread Dmitry Olshansky
Hello, I have a problem with using Takusen in my current project because it uses old QuickCheck 1.*. This leads to conflict with other packages which use QuickCheck 2.*. Could someone help me to decide this problem? Best wishes, Dmitry ___ Haskell-Cafe

[Haskell-cafe] Bug with [Double]

2010-05-19 Thread Dmitry Olshansky
Hello all, It seems that I saw something like this in Cafe recevtly. But I am not sure... In GHC 6.12.1 (Platform 2010 on Windows Vista) I have Prelude [1,1+2/3..10]

Re: [Haskell-cafe] Bug with [Double]

2010-05-19 Thread Dmitry Olshansky
ivan.miljeno...@gmail.com: Dmitry Olshansky olshansk...@gmail.com writes: Hello all, It seems that I saw something like this in Cafe recevtly. But I am not sure... In GHC 6.12.1 (Platform 2010 on Windows Vista) I have Prelude [1,1+2/3..10

Re: [Haskell-cafe] Bug with [Double]

2010-05-19 Thread Dmitry Olshansky
Thanks, it's clear now. 2010/5/19 Serguey Zefirov sergu...@gmail.com: 2010/5/19 Erik de Castro Lopo mle...@mega-nerd.com: Dmitry Olshansky wrote: It seems that I saw something like this in Cafe recevtly. But I am not sure... In GHC 6.12.1 (Platform 2010 on Windows Vista) I have snip

[Haskell-cafe] instance reification in TH

2010-04-22 Thread Dmitry Olshansky
Hello cafe, Could you say can I determine in Template Haskell that datatype X has instance of class Y? Regards, Dmitry ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] ErrorT instance of MonadPlus

2010-02-26 Thread Dmitry Olshansky
Hello, ErrorT instance of MonadPlus define that in case of fail both arguments of mplus a value of Error will be the Error of second computation: m `mplus` n = ErrorT $ doa - runErrorT mcase a of Left _ - runErrorT nRight r - return (Right r) Could it

Re: [Haskell-cafe] Haskell2Xml - Suggest looking at HXT

2009-08-11 Thread Dmitry Olshansky
be encoded and decoded as XML. Its not pretty, has bugs, and is far from perfect but I can send that to you if you'd like a way to get stared. Max On Aug 7, 2009, at 7:04 PM, Dmitry Olshansky wrote: Well, great thanks for interesting links. But definitely at first I need a time to try

Re: [Haskell-cafe] Network.Curl and posting XML data

2009-08-11 Thread Dmitry Olshansky
Hi, Erik, Did you try Network.HTTP? Is it not enough? 2009/8/12 Erik de Castro Lopo mle...@mega-nerd.com mle%2...@mega-nerd.com Hi all, I need to do a HTTP post of XML data (Content-type == text/xml) to a HTTP (eventually HTTPS) server and to retrieve both the response code and some

Re: [Haskell-cafe] Haskell2Xml

2009-08-07 Thread Dmitry Olshansky
Like in Keith proposal I need it for working with web-services, maybe Xml transformations and so on. And I tried to make it by self with a partial success. To work with xml I only used xml package (Text.XML.Light). Now I am going to work a little (?) on this task to provide more standard and

Re: [Haskell-cafe] Haskell2Xml

2009-08-07 Thread Dmitry Olshansky
Well, great thanks for interesting links. But definitely at first I need a time to try to understand what Generic Haskell and EMGM are. Does it stronger than Template Haskell? Could it be explained briefly and simplistic for first impression? Could it be compared with SYB or TH? Would it be

Re: [Haskell-cafe] Efficient functional idiom for histogram

2009-08-05 Thread Dmitry Olshansky
My measurements show that - using strict version of insertWith doesn't improve performance. - in case of compilation with -O2 flag foldl' also is equal to foldl (-O2 gives approx 2 time impovements).- using RandomGen and State monad to generate a list gives at least 4 times improvements (on 1 000

Re: [Haskell-cafe] Efficient functional idiom for histogram

2009-08-05 Thread Dmitry Olshansky
I got the impression Dmitry was using Haskell's standard RNG, not Mersenne Twister. If so, then we'd get further improvements with MT, but that's still a hit against Haskell, as I'd interpret it as meaning that Haskell supplies as default a PRNG which costs noticeable performance in order to

[Haskell-cafe] Haskell2Xml

2009-08-05 Thread Dmitry Olshansky
Hello all, I need a convenient tool to generate Haskell types from XML W3C Schema Definition (xsd) and vice versa - generate instances for Haskell ADT's to make corresponding XML. It is just the same that HaXml do with DTD. I need - using XSD - support for unicode - using xml-attributes as far as