Re: [Haskell-cafe] Parsec question

2013-07-24 Thread C K Kashyap
ybe? I'd like it very much if I could get > > an example of a missed match by not using the complete match. > > > > regards, > > Kashyap > > > > Sent from my Windows Phone > > From: Roman Cheplyaka > > Sent: 24/07/2013 8:19 PM > > To: C K Kash

Re: [Haskell-cafe] Parsec question

2013-07-24 Thread C K Kashyap
gt; I can't guarantee this is any good, and I haven't looked at it in a while, > but at [1] I have an example of using exceptions to get a parsec-like > backtracking-when-explicitly-allowed parser. I was planning on writing an > article about how to do this technique, but I neve

[Haskell-cafe] Parsec question

2013-07-24 Thread C K Kashyap
Dear Cafe, I am trying to implement[1] parsec in go using the "Monadic Parser Combinators" paper [2] . I've been able to implement "plus" "bind" and "many" While doing the implementation - I looked at bind closely bind :: Parser a -> (a -> Parser b) -> Parser b p `bind` f = \inp -> concat [f v in

Re: [Haskell-cafe] Implementing an embedded language that threads a global structure.

2013-04-22 Thread C K Kashyap
Hi Ian, I have a couple of questions for you - 1. Could you explain why a lambda calculus like language embedded in Haskell would be useful - I ask this because, the way I understand, Haskell is already such a language - one could easily chose to restrict oneself to just function definition and ap

Re: [Haskell-cafe] Assembly EDSL in Haskell

2013-04-01 Thread C K Kashyap
> > hello = [move RAX RAX, move RAX RAX] > > hello2 = [move RAX RAX, move RAX RBX] -- this is still not allowed. > > > > > 2013/4/1 C K Kashyap > >> Hi Cafe, >> I am trying to embed x86 assembly in Haskell. I'd like the EDSL to not >> allow invalid movem

[Haskell-cafe] Assembly EDSL in Haskell

2013-04-01 Thread C K Kashyap
Hi Cafe, I am trying to embed x86 assembly in Haskell. I'd like the EDSL to not allow invalid movements into registers - for example, should not allow moving into RIP. I was not able to get it to work. I ended up using DataTypeContexts - which is considered misfeature anyway. I was wondering if I c

Re: [Haskell-cafe] Need some advice around lazy IO

2013-03-24 Thread C K Kashyap
here > ast = parse (spaces >> xmlParser) "" str > f (Right x) = x > > f (Left x) = CouldNotParse > > > Also see this post[1] My Space is Leaking.. > > Regards, > Mukesh Tiwari > > [1] http://www.mega-nerd.com/erikd/Blog/ >

Re: [Haskell-cafe] Need some advice around lazy IO

2013-03-22 Thread C K Kashyap
, 2013 at 11:07 AM, C K Kashyap wrote: > I got some profiling done and got this pdf generated. I see unhealthy > growths in my XML parser. > > > > On Fri, Mar 22, 2013 at 8:12 PM, C K Kashyap wrote: > >> Hi folks, >> >> I've run into more issues wi

Re: [Haskell-cafe] Need some advice around lazy IO

2013-03-22 Thread C K Kashyap
I got some profiling done and got this pdf generated. I see unhealthy growths in my XML parser. On Fri, Mar 22, 2013 at 8:12 PM, C K Kashyap wrote: > Hi folks, > > I've run into more issues with my report generation tool I'd really > appreciate some help. > >

Re: [Haskell-cafe] Need some advice around lazy IO

2013-03-22 Thread C K Kashyap
Hi folks, I've run into more issues with my report generation tool I'd really appreciate some help. I've created a repro project on github to demonstrate the problem. git://github.com/ckkashyap/haskell-perf-repro.git There is a template xml file that needs to be replicated several times (30

Re: [Haskell-cafe] A question about data declaration

2013-03-21 Thread C K Kashyap
ame, Array and Dictionary - while array is list of objects, the Disctionary is a list of tuples (Name, Object) not (Object, Object) - hence my situation. Regards, Kashyap On Thu, Mar 21, 2013 at 8:58 PM, Brent Yorgey wrote: > On Thu, Mar 21, 2013 at 06:18:46PM +0530, C K Kashyap wrote: > >

[Haskell-cafe] A question about data declaration

2013-03-21 Thread C K Kashyap
Hi, I have a situation where I need to define a data type T such that data T = C1 Int | C2 Char | C3 T However, I want to enforce a constraint that C3 only allows (C2 Char) and not (C1 Int). That is x = C3 (C1 10) -- should not compile - but my above definition will let it compile I was think

Re: [Haskell-cafe] Need some advice around lazy IO

2013-03-18 Thread C K Kashyap
Thanks Konstantin ... I'll try that out too... Regards, Kashyap On Mon, Mar 18, 2013 at 3:31 PM, Konstantin Litvinenko < to.darkan...@gmail.com> wrote: > On 03/17/2013 07:08 AM, C K Kashyap wrote: > >> I am working on an automation that periodically fetches bug data f

Re: [Haskell-cafe] Need some advice around lazy IO

2013-03-17 Thread C K Kashyap
t the > handle. -} > > firstLine :: MonadIO m => Sink Handle m () > > firstLine = awaitForever (liftIO . (hGetLine >=> putStrLn)) > > > main = do > > args <- getArgs > > > runResourceT $ sourceList args =$= fileConduit ReadMode $$ firstLine >

[Haskell-cafe] Need some advice around lazy IO

2013-03-16 Thread C K Kashyap
Hi, I am working on an automation that periodically fetches bug data from our bug tracking system and creates static HTML reports. Things worked fine when the bugs were in the order of 200 or so. Now I am trying to run it against 3000 bugs and suddenly I see things like - too many open handles, o

Re: [Haskell-cafe] ANNOUNCE: netpbm

2013-03-02 Thread C K Kashyap
That sounds cool Way to go Niklas!!! Regards, Kashyap On Sat, Mar 2, 2013 at 6:24 AM, Niklas Hambüchen wrote: > I'm happy to announce a new library, "netpbm", a full implementation of > the netpbm image formats (PPM, PGM, PBM) in pure Haskell. > > The P*N formats describe themselves as "as

Re: [Haskell-cafe] Question about forkIO

2013-02-28 Thread C K Kashyap
Hey Donn .. thanks, it turns out that threads do resume!!! This is how I got my gmail stuff working. I only have a doubt if the TCP "keep/alive" stuff continues to happen or not Regards, Kashyap On Thu, Feb 28, 2013 at 9:07 PM, Donn Cave wrote: > Quoth C K Kashyap , &g

Re: [Haskell-cafe] How to return a network connection to C

2013-02-28 Thread C K Kashyap
ve to see what kind of performance hit my DLL has ... Regards, Kashyap On Fri, Mar 1, 2013 at 12:07 AM, Donn Cave wrote: > Quoth C K Kashyap , > > > I am using http://hackage.haskell.org/package/connection. > > So I create network connection in Haskell > > > > getConn

Re: [Haskell-cafe] How to return a network connection to C

2013-02-28 Thread C K Kashyap
t; deprecated. > > On 28/02/13 06:14, C K Kashyap wrote: > > Hi, > > I am using Network.Connection to connect to gmail in my Haskell module - > > that's compiled to DLL and invoked from C. > > > > I need a mechanism to return the connection handle

Re: [Haskell-cafe] Question about forkIO

2013-02-28 Thread C K Kashyap
that would allow the threads sparked to continue execute. Regards, Kashyap On Thu, Feb 28, 2013 at 4:39 PM, C K Kashyap wrote: > Hi All, > > Say I have a haskell function 'f' that does a forkIO and starts an action > "a". I create a DLL of this haskell code and inov

[Haskell-cafe] Question about forkIO

2013-02-28 Thread C K Kashyap
Hi All, Say I have a haskell function 'f' that does a forkIO and starts an action "a". I create a DLL of this haskell code and inovke "f" from C. Can I expect the "a" to continue to run once "f" has returned to C? Regards, Kashyap ___ Haskell-Cafe mail

[Haskell-cafe] How to return a network connection to C

2013-02-27 Thread C K Kashyap
Hi, I am using Network.Connection to connect to gmail in my Haskell module - that's compiled to DLL and invoked from C. I need a mechanism to return the connection handle to C so that it can pass it in the subsequent calls. How can I achieve this? Regards, Kashyap

Re: [Haskell-cafe] Running out of space while concatinating a list of bytestring

2013-02-27 Thread C K Kashyap
Oops, false alarm. Please ignore - and sorry about it. Regards, Kashyap On Wed, Feb 27, 2013 at 1:32 PM, C K Kashyap wrote: > Hi, > > I have the following code - It looks like things go okay until > concatination is attempted. I get the following output > > There ar

[Haskell-cafe] Running out of space while concatinating a list of bytestring

2013-02-27 Thread C K Kashyap
Hi, I have the following code - It looks like things go okay until concatination is attempted. I get the following output There are 2258 ByteStrings *** Exception: : hPutBuf: resource exhausted (Not enough space) I am thinking that I should do strict concatination at each point in the support fu

Re: [Haskell-cafe] Need urgent help with Network.tls

2013-02-23 Thread C K Kashyap
Okay ... now magically, I stopped seeing the "WSACONNECTIONREFUSED" error!!! .. Regards, Kashyap On Sun, Feb 24, 2013 at 10:03 AM, C K Kashyap wrote: > Okay ... looks like connection is exactly what I want The examples > work just fine on Linux .. however, on Windows, I

Re: [Haskell-cafe] Need urgent help with Network.tls

2013-02-23 Thread C K Kashyap
Okay ... looks like connection is exactly what I want The examples work just fine on Linux .. however, on Windows, I continue to get the WSACONNECTIONREFUSED eror. Even adding a "withSocketsDo" does not seem to help. Regards, Kashyap On Sun, Feb 24, 2013 at 8:58 AM, C K Kash

Re: [Haskell-cafe] Need urgent help with Network.tls

2013-02-23 Thread C K Kashyap
, Kashyap On Sun, Feb 24, 2013 at 3:42 AM, Vincent Hanquez wrote: > On 02/23/2013 06:58 PM, C K Kashyap wrote: > >> The reason I want to use TLS is that I'd want to pack the whole thing in a >> DLL and give it off to a friend for use. >> >> What I am really look

Re: [Haskell-cafe] Need urgent help with Network.tls

2013-02-23 Thread C K Kashyap
That is the reason I wanted to get a standalone library ... again, I might have got the whole thing wrong. Regards, Kashyap On Sun, Feb 24, 2013 at 3:54 AM, Jason Dusek wrote: > 2013/2/23 C K Kashyap : > > The reason I want to use TLS is that I'd want to pack the whole thing in &

Re: [Haskell-cafe] Need urgent help with Network.tls

2013-02-23 Thread C K Kashyap
2013 at 10:46 PM, satvik chauhan wrote: > You can use HaskellNet <http://hackage.haskell.org/package/HaskellNet> or > imapget <http://hackage.haskell.org/package/imapget> directly or look > into their source code for connecting to imap manually. > > -Satvik > >

[Haskell-cafe] Need urgent help with Network.tls

2013-02-23 Thread C K Kashyap
Hi, I am trying to use Haskell to download email/attachments from gmail. For which I am exploring Network.TLS. I got this sample from the net that connects to gmail smtp and works just fine - http://hpaste.org/82890 However, when I modify it a bit to try to connect to imap, it simply does not wor

Re: [Haskell-cafe] Chordify, a new web startup using Haskell

2013-01-17 Thread C K Kashyap
Very cool :) I tried this one http://chordify.net/chords/jamelia-superstar-emimusic Not sure if the places it showed E flat - was it really E flat minor? What next - index all the songs using their "chordification" and then search them using a "hum" as input :) Regards, Kashyap On Fri, Jan 18,

[Haskell-cafe] Is Hackage down?

2012-09-13 Thread C K Kashyap
Is it just me or is Hackage indeed been going down more frequently of late? Regards, Kashyap ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Code review request - using ErrorT

2012-08-31 Thread C K Kashyap
Dear gentle Haskellers, I'd appreciate it very much if you could please take a look the my code here and give me some feedback - https://github.com/ckkashyap/haskell-websocket/blob/master/src/lib/Net/WebSocket/Request.hs I am particularly looking for advice around what would be a good type for a

Re: [Haskell-cafe] Current state of garbage collection in Haskell

2012-07-30 Thread C K Kashyap
ing keeping up, Simon Marlow is the main person working on GHC's > GC (often collaborating with others) and he keeps a list of papers on > his homepage: http://research.microsoft.com/en-us/people/simonmar/ > > If you have further questions about GHC's GC, you can ask them on

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

2012-07-30 Thread C K Kashyap
Thank you Richard and Antoine. I think I see the pointlessness of my ask. Regards, Kashyap On Mon, Jul 30, 2012 at 4:14 AM, Richard O'Keefe wrote: > > On 29/07/2012, at 6:21 PM, C K Kashyap wrote: > > I am struggling with an idea though - How can I capture the parent > ele

[Haskell-cafe] Current state of garbage collection in Haskell

2012-07-29 Thread C K Kashyap
Hi, I was looking at a video that talks about GC pauses. That got me curious about the current state of GC in Haskell - say ghc 7.4.1. Would it suffer from lengthy pauses when we talk about memory in the range of 500M +? What would be a good way to keep abreast with the progress on haskell GC? Rega

[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] Need help with learning Parsec

2012-07-23 Thread C K Kashyap
Thank you so much Christian for your feedback ... I shall incorporate them. Regards, Kashyap On Mon, Jul 23, 2012 at 3:17 PM, Christian Maeder wrote: > Am 22.07.2012 17:21, schrieb C K Kashyap: > > I've updated the parser here - >> https://github.com/ckkashyap/**Learning

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

2012-07-22 Thread C K Kashyap
Thanks a lot Antonie and Simon. Regards, Kashyap On Mon, Jul 23, 2012 at 12:15 AM, Antoine Latter wrote: > On Sun, Jul 22, 2012 at 11:00 AM, C K Kashyap wrote: > > What's the function to access it? > > > > The function 'runParser' returns either a result or

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

2012-07-22 Thread C K Kashyap
What's the function to access it? On Sun, Jul 22, 2012 at 9:16 PM, Simon Hengel wrote: > > I have an outstanding question - What's the second parameter of the > > parse function really for? > > It's used to refer to the source file on parse errors. > > Cheers, > Simon > _

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

2012-07-22 Thread C K Kashyap
? Regards, Kashyap On Thu, Jul 19, 2012 at 8:31 PM, C K Kashyap wrote: > Thank you so much ... I've updated my monad version here - > > > https://github.com/ckkashyap/LearningPrograms/blob/master/Haskell/Parsing/xml_1.hs<https://github.com/ckkashyap/LearningPrograms/blob/m

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.hs and the Applicative version here - https://github.com/ckkashyap/Learni

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

Re: [Haskell-cafe] Non-greedy match in Text.Regx.Posix

2012-07-17 Thread C K Kashyap
Thanks Roman, I guess I better invest my time in Parsec then :) Regards, Kashyap On Tue, Jul 17, 2012 at 5:05 PM, Roman Cheplyaka wrote: > * C K Kashyap [2012-07-17 13:31:05+0530] > > I was exploring Text.Regex.Posix and found that I was not able to do a > > non-greedy match b

[Haskell-cafe] Non-greedy match in Text.Regx.Posix

2012-07-17 Thread C K Kashyap
Hi all, I was exploring Text.Regex.Posix and found that I was not able to do a non-greedy match by modifying the quantifier with a "?". How can I achieve non-greedy match in Text.Regex.Posix? Regards, Kashyap ___ Haskell-Cafe mailing list Haskell-Cafe@h

Re: [Haskell-cafe] OpenShift a free PaaS from RedHat

2012-07-05 Thread C K Kashyap
Thank you Micheal and Satvik. I think cde should solve the problem - I'll confirm later - for some reason, I do not have SSH connectivity from my office. What'll be best though is - yesod on OpenShift :) Regards, Kashyap On Fri, Jul 6, 2012 at 10:51 AM, satvik chauhan wrote: > >> OpenShift give

Re: [Haskell-cafe] OpenShift a free PaaS from RedHat

2012-07-05 Thread C K Kashyap
two things - 1. GLIBC version mismatch 2. libgmp missing on the openshift box Regards, Kashyap On Thu, Jul 5, 2012 at 9:19 PM, Shakthi Kannan wrote: > Hi, > > --- On Thu, Jul 5, 2012 at 8:41 PM, C K Kashyap > wrote: > | I just found out about OpenShift - its a free PaaS from

Re: [Haskell-cafe] Is haskell.org down?

2012-07-05 Thread C K Kashyap
Thanks! Regards, Kashyap On Thu, Jul 5, 2012 at 4:20 PM, Ivan Lazar Miljenovic < ivan.miljeno...@gmail.com> wrote: > Not anymore! > > On 5 July 2012 15:13, C K Kashyap wrote: > > Regards, > > Kashyap > > > > __

[Haskell-cafe] OpenShift a free PaaS from RedHat

2012-07-05 Thread C K Kashyap
Hi Folks, I just found out about OpenShift - its a free PaaS from RedHat. It has some interesting offerings. It does not support Haskell out of the box as of now. Please do check it out and if you like it - vote for Haskell support on it here - https://openshift.redhat.com/community/content/suppor

[Haskell-cafe] Is haskell.org down?

2012-07-05 Thread C K Kashyap
Regards, Kashyap ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] An attempt at an EDSL for platform independent 3D animation

2012-06-03 Thread C K Kashyap
Hi All, I've written a Haskell program that allows you to describe "dance movements" and it spits out javascript that does animation on an HTML 5 canvas (that's the platform independent bit). https://github.com/ckkashyap/Dancer Please do check it out and let me know what you think - all you'd ne

Re: [Haskell-cafe] Need inputs for a Haskell awareness presentation

2012-06-01 Thread C K Kashyap
Thank you all very much, I am sitting now and collating all your responses. I'll revert with questions if I may have. Indeed, it may be better to have this kind of collateral ready for future use. I am going to put my stuff on github considering markdown + pandoc. Regards, Kashyap On Sat,

[Haskell-cafe] Need inputs for a Haskell awareness presentation

2012-05-31 Thread C K Kashyap
Hi folks, I have the opportunity to make a presentation to folks (developers and managers) in my organization about Haskell - and why it's important - and why it's the only way forward. I request you to share your experiences/suggestions for the following - 1. Any thoughts around the outline of th

[Haskell-cafe] Need feedback on my EDSL attempt for writing test scripts

2012-04-23 Thread C K Kashyap
Dear cafe, Recently, I decided to use Haskell to drive the testing of a C++ DLL that we develop. After getting the FFI etc working, I thought it might be a good idea to expose an EDSL for the testers to alter the flow of invocations of the functions in the DLL. I've tried to demonstrate the approac

Re: [Haskell-cafe] An idea to document inter department dependencies in Haskell

2012-03-14 Thread C K Kashyap
ve, in the form of > a textual description of activities). > > Thus, the power users should handle the abstract descriptions, and the > ordinary users could run the engine, perhaps they should answer some > questions to obtain the concrete workflows for their intended tasks > >

[Haskell-cafe] An idea to document inter department dependencies in Haskell

2012-03-13 Thread C K Kashyap
My dear Haskell folks, I work in a software company where I develop components that go into a really complex system that's built of several components developed by different teams that are geographically distributed. The components themselves run in a distributed manner across client and several s

Re: [Haskell-cafe] [haskell-cafe] Question about 64bit target on Windows platform

2012-03-05 Thread C K Kashyap
On Mon, Mar 5, 2012 at 2:54 PM, Simon Marlow wrote: > There is a possibility that the IHG might fund this during the next cycle, > which would mean that it would be in 7.6.1. > > Cheers, >Simon > > That is very good to hear!!! Regards, Kashyap

Re: [Haskell-cafe] [haskell-cafe] Question about 64bit target on Windows platform

2012-03-05 Thread C K Kashyap
ket for this: > http://hackage.haskell.org/trac/ghc/ticket/1884 > > On Sun, Mar 4, 2012 at 9:59 PM, C K Kashyap wrote: > > Hi All, > > Can someone please let me know if there is a 64bit target on Windows on > the > > horizon for GHC? > > I am trying to push for changing the

[Haskell-cafe] [haskell-cafe] Question about 64bit target on Windows platform

2012-03-04 Thread C K Kashyap
Hi All, Can someone please let me know if there is a 64bit target on Windows on the horizon for GHC? I am trying to push for changing the current implementation in my organization in C++ to Haskell - Our primary targets are Windows and Mac. Not being able to generate 64bit DLL's on Windows would be

Re: [Haskell-cafe] Need advice: Haskell in Web Client

2012-01-17 Thread C K Kashyap
On Tue, Jan 17, 2012 at 4:19 PM, dokondr wrote: > Hi all, > I hope to use Haskell for graphics (charts) programming in Web client. > > My current implementation in brief: > Server side, Haskell modules: > 1) collecting various statistics from Twitter > 2) generating text data for Gnuplot (http://

Re: [Haskell-cafe] DB vs read/show for persisting large data

2011-12-16 Thread C K Kashyap
Thank you so much .. I am going to try out acid-state. I've been shying away from template-haskell ... but from the looks of it, acid-state/safecopy can do what I am looking for. Regards, Kashyap On Thu, Dec 15, 2011 at 12:13 AM, Bas van Dijk wrote: > On 14 December 2011 15:22, Claude Heiland-Al

[Haskell-cafe] DB vs read/show for persisting large data

2011-12-14 Thread C K Kashyap
Hi, It has been on my todo list for some time now. I'd like to write a GTD tool that has dependency tracking support. Haskell seems like a good choice for this. I was wondering if there has been any past attempts with this? One thing that has been bothering me has been this - the persistence of d

[Haskell-cafe] why the name lambda calculus?

2011-08-21 Thread C K Kashyap
Hi, Can someone please tell me what is the root of the name lambda calculus? Is it just because of the symbol lambda that is used? Why not alpha or beta calculus? Regards, Kashyap ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.o

Re: [Haskell-cafe] Embedding Perl RegEx in Haskell

2011-08-20 Thread C K Kashyap
> > > Why not just go with anchorHead and anchorTail or similar? And a capture > could simply be > > Thanks for your inputs Brandon. I've updated the code with anchors. Still trying to get a hold of captures. Regards, Kashyap ___ Haskell-Cafe mailing li

[Haskell-cafe] Embedding Perl RegEx in Haskell

2011-08-18 Thread C K Kashyap
Dear Haskell folks, I was attempting to do an EDSL that would allow me to describe regular expressions in Hakell and generate Perl as target - https://github.com/ckkashyap/LearningPrograms/blob/master/Haskell/edsl/regex.hs $ ghci regex.hs GHCi, version 7.0.3: http://www.haskell.org/ghc/ :? for

Re: [Haskell-cafe] Building ? using kleene closure {not haskell specific}

2011-08-12 Thread C K Kashyap
On Fri, Aug 12, 2011 at 4:34 PM, Sebastian Fischer wrote: > > I can easily understand how + can be built but am having trouble with > > building ? (zero or one). > > If there is a regular expression e for the empty word, one can define ? as > >a? = e | a > > If there is a regular expression o

[Haskell-cafe] Building ? using kleene closure {not haskell specific}

2011-08-12 Thread C K Kashyap
Hello gentle Haskell folks, I happened to read "Beautiful code"'s chapter 1 today and found Brian Kerninghan's regex implementation. In it he only shows the * meta character. I can easily understand how + can be built but am having trouble with building ? (zero or one). I'd really appreciate it if

Re: [Haskell-cafe] Generating simple histograms in png format?

2011-06-12 Thread C K Kashyap
You might find this useful - http://www.haskell.org/haskellwiki/Library/PNG Btw, I too am looking for such a library. Regards, Kashyap On Sat, Jun 11, 2011 at 3:32 AM, Dmitri O.Kondratiev wrote: > I am looking for platform-independent library to generate simple histograms > in png format. > Does

Re: [Haskell-cafe] Modeling the performance of a non-trivial software app

2011-05-10 Thread C K Kashyap
> > Sometimes it is possible to write the corresponded model. Then the model > can be simulated to receive the performance characteristics. Much depends on > that how precise the model is. The keywords are Discrete Event Simulation > (DES) and Theory of Queue. It may require some maths. > > I wrote

[Haskell-cafe] Modeling the performance of a non-trivial software app

2011-05-10 Thread C K Kashyap
Hi, I was wondering if it would be a good idea to model a software app's performance using Haskell. The idea is a little abstract in my mind right now. I'll try and illustrate it with an example - Let's say, I want to model a web app - to, model it, I could think of the following entities - 1. One

[Haskell-cafe] Another good video tutorial on monads

2011-05-04 Thread C K Kashyap
http://vimeo.com/20717301 I really liked how he starts off with the let statement. Regards, Kashyap ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Looking for feedback on my attempt at a tree construction edsl

2011-03-23 Thread C K Kashyap
> > A shallow embedding would typically use just functions - a famous > example is Paul Hudak's "region server". A deep embedding would build > syntax - represented with data types - and interpret the syntax or > compile the syntax for another use (so called "off-shoring" e.g. Conal > Elliott's Pan

Re: [Haskell-cafe] Looking for feedback on my attempt at a tree construction edsl

2011-03-22 Thread C K Kashyap
Hi, I've tried a non-monadic version based on the suggestions here - https://github.com/ckkashyap/LearningPrograms/blob/master/Haskell/edsl/TreeWithoutMonad.hs This implementation seems to lack the "indentation based" approach that the do syntax allows. Would I be right if I said that the non-mona

[Haskell-cafe] Looking for feedback on my attempt at a tree construction edsl

2011-03-22 Thread C K Kashyap
Hi, With my "edsl", one can describe a tree like this - import TreeEdsl import Data.Tree createTree :: TreeContext String () createTree = do insertSubTree "Fruits" $ do insertLeaf "Apple" insertLeaf "Mango" insertSubTree "Arbitrary" $ do insertSubTree "Numbers" $ do insertLeaf "1" insertLeaf "2"

Re: [Haskell-cafe] Data.Time.Calendar.Day does not seem to have an instance for Read

2011-03-17 Thread C K Kashyap
> > > So then it's not a bug. The instance is defined in > Data.Time.Format.Parse, and Data.Time.Calendar doesn't import that > module. > > This, however is a bug, I think: > > Prelude> import Data.Time > Prelude Data.Time> read "2011-10-10" :: Day > > ... no instance for (Read Day) ... > > Prelude

Re: [Haskell-cafe] Data.Time.Calendar.Day does not seem to have an instance for Read

2011-03-16 Thread C K Kashyap
> > On Thu, Mar 17, 2011 at 12:30 AM, C K Kashyap wrote: > > Hi, > > I was wondering if this is a defect - > > Prelude> import Data.Time.Calendar > > Prelude Data.Time.Calendar> read "2011-10-10" :: Day > > :1:1: > > No ins

Re: [Haskell-cafe] Data.ByteString.Lazy.ByteString vs Data.ByteString.Lazy.Internal.ByteString

2011-03-16 Thread C K Kashyap
I had started exploring the internal - PS constructor route looking at the base64 encoding implementation by Bryan (which is really fast - http://www.serpentine.com/blog/2010/09/02/fast-base64-encoding-and-decoding-in-haskell/)- I was wondering if we don't use the PS constructor can we implement ba

[Haskell-cafe] Data.Time.Calendar.Day does not seem to have an instance for Read

2011-03-16 Thread C K Kashyap
Hi, I was wondering if this is a defect - Prelude> import Data.Time.Calendar Prelude Data.Time.Calendar> read "2011-10-10" :: Day :1:1: No instance for (Read Day) arising from a use of `read' Possible fix: add an instance declaration for (Read Day) In the expression: read "2011-

Re: [Haskell-cafe] Data.ByteString.Lazy.ByteString vs Data.ByteString.Lazy.Internal.ByteString

2011-03-13 Thread C K Kashyap
> > Looks like a job for Data.Binary. > > > I'd like to use it with just the libraries that are part of the platform > > I forgot to mention, Data.Binary does not seem to be in the platform. Regards, Kashyap ___ Haskell-Cafe mailing list Haskell-Cafe@has

Re: [Haskell-cafe] Data.ByteString.Lazy.ByteString vs Data.ByteString.Lazy.Internal.ByteString

2011-03-13 Thread C K Kashyap
Thanks Brandon, data Endian = Big | Little data Size = Eight | Sixteen | ThirtyTwo | SixtyFour type EncTuple = (Int,Size,Endian) My requirement is to write encode :: [EncTuple] -> ByteString I'd like to use it with just the libraries that are part of the platform - and I am not a fan of using the

Re: [Haskell-cafe] Data.ByteString.Lazy.ByteString vs Data.ByteString.Lazy.Internal.ByteString

2011-03-11 Thread C K Kashyap
Hi Don, What would be a good way to figure out the usage of ByteString - particularly the PS constructor. Regards, Kashyap On Fri, Feb 11, 2011 at 10:01 AM, C K Kashyap wrote: > >> Yep, the 'Internal' module is where the type is defined, and then >> re-exported t

[Haskell-cafe] Getting started with http-enumerator

2011-03-04 Thread C K Kashyap
Hi, I'd like to use http-enumerator for things that I've been using perl/Lwp for. I tried looking but was not able to find good documentation for it. Could someone please point me to simple examples? Like posting a form, dealing with cookies etc. Regards, Kashyap ___

Re: [Haskell-cafe] Performance difference between ghc and ghci

2011-02-22 Thread C K Kashyap
> > >> > GHCi doesn't perform any optimizations, so whenever you're running > interpreted bytecode there's a significant performance hit. However, if you > compile the code, you can run the compiled/optimized version from GHCi as > well. > > -- > I missed out the optimization bit yes, that wo

[Haskell-cafe] Performance difference between ghc and ghci

2011-02-21 Thread C K Kashyap
Hi, Is there a runtime performance difference between a haskell program running under GHCI vs in its compiled form? Especially for a long running program - as in, ignoring the initial setup time. If I understand right, in both case tree reduction is what is happening and performance should be simil

Re: [Haskell-cafe] Unable to get parallelism using `par`

2011-02-18 Thread C K Kashyap
> > > Hmm, using parSumFibEuler instead of sumFibEuler, I get > 100% CPU usage > (close to 200% if I adjust parameters so both computations take > approximately the same time). > Works for me, then. > Thanks Daniel!!! ___ Haskell-Cafe mailing list Haskel

[Haskell-cafe] Unable to get parallelism using `par`

2011-02-17 Thread C K Kashyap
Hi, I tried the first example from "A tutorial on Parallel and Concurrent programming in Haskell" but I cant seem to get sparks to get converted to OS threads. Below is the program I am using. I did ghc --make -threaded program.hs then ./program +RTS -N2 I don't see any speed gain compared to N1.

Re: [Haskell-cafe] Review request for "platform independent interactive graphics" with VNC

2011-02-16 Thread C K Kashyap
Hi, I've refined this further ... earlier, each framebuffer update involved sending the whole screen back, now, only the incremental changes are sent. Drawing on very large images are quick now!! Real fun will be when I can do rendering of graphics by typing things at the ghci prompt!!! https://

Re: [Haskell-cafe] Proving correctness

2011-02-12 Thread C K Kashyap
> > many of the subtleties encountered in the process. I am often 100% > sure of the correctness of my refactors. > > While I have an intuitive understanding of what you mean about the correctness of refactoring ... I personally feel much more comfortable refactoring Haskell code ... as in - as lo

[Haskell-cafe] Proving correctness

2011-02-11 Thread C K Kashyap
Hi Folks, I've come across this a few times - "In Haskell, once can prove the correctness of the code" - Is this true? I know that static typing and strong typing of Haskell eliminate a whole class of problems - is that related to the proving correctness? Is it about Quickcheck - if so, how is it

Re: [Haskell-cafe] Data.ByteString.Lazy.ByteString vs Data.ByteString.Lazy.Internal.ByteString

2011-02-10 Thread C K Kashyap
> > > Yep, the 'Internal' module is where the type is defined, and then > re-exported through the regular module. > > Thanks Don ... good to know. Regards, Kashyap ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listi

[Haskell-cafe] Data.ByteString.Lazy.ByteString vs Data.ByteString.Lazy.Internal.ByteString

2011-02-10 Thread C K Kashyap
Hi, I noticed that even though I declare the type of a function in my code as Data.ByteString.Lazy.ByteString ... when I check it out in ghci using :t, it shows this - Data.ByteString.Lazy.Internal.ByteString Is this expected? Regards, Kashyap ___ Haskell

[Haskell-cafe] Split function

2011-02-08 Thread C K Kashyap
Hi, Is this a good implementation of split function? ... I was wondering about the "lines" function, it basically a special case of split right? split c xs = foldr f [[]] xs where f x list@(l:ls)= if x == c then []:list else (x:l):ls Regards, Kashyap

Re: [Haskell-cafe] forkIO on GHCI does not seem to spawn the thread in the background on some OSs

2011-02-08 Thread C K Kashyap
> > > I can't reproduce this. What are you using as the action? > > I've tried bottoms, and tight loops whose Core contains no allocations, and > not > managed to lock up the prompt, or seen ghci using more threads than I have > cores. > > One thing that may give the appearance of locking up the pr

Re: [Haskell-cafe] Help needed for converting IOArray to ByteString

2011-02-08 Thread C K Kashyap
> > > 1) Just use Data.Word.Word8 instead of the second Int in your type sig > for IOArray > 2) Use getElems to get a [Word8] > 3) Data.ByteString.pack converts a [Word8] into a ByteString > > Michael > I am currently using a list of tuples - [(Int,Int,Int)] to represent an image buffer. You can s

Re: [Haskell-cafe] Help needed for converting IOArray to ByteString

2011-02-08 Thread C K Kashyap
On Tue, Feb 8, 2011 at 2:26 PM, Michael Snoyman wrote: > Your array contains machine-sized Ints, which in practice are likely > either 32-bit or 64-bit, while a ByteString is the equivalent of an > array or 8-bit values. So you'll need to somehow convert the Ints to > Word8s. Do you know if you n

[Haskell-cafe] Help needed for converting IOArray to ByteString

2011-02-08 Thread C K Kashyap
Hi, I need to convert IOArray to bytestring as shown below - import Data.Array.IO import Data.Binary.Put import qualified Data.ByteString.Lazy as BS import Data.Word main = do arr <- newArray (0,9) 0 :: IO (IOArray Int Int) let bs=toByteString arr return () How can I implement the 'toByteString'

[Haskell-cafe] forkIO on GHCI does not seem to spawn the thread in the background on some OSs

2011-02-07 Thread C K Kashyap
Hi, I found that on windows and my ubuntu box, when I did this ghci> t <- forkIO someAction "someAction" started executing in the foreground - as in, the ghci prompt did not come back (until I pressed Ctrl-C) On my mac however, when I ran the same thing, the action started executing in the backg

Re: [Haskell-cafe] Extending GHCi

2011-02-07 Thread C K Kashyap
> > > $ ghci > GHCi, version 6.12.3: http://www.haskell.org/ghc/ :? for help > Loading package ghc-prim ... linking ... done. > Loading package integer-gmp ... linking ... done. > Loading package base ... linking ... done. > Loading package ffi-1.0 ... linking ... done. > Prelude> :m +Data.IORef C

Re: [Haskell-cafe] Review request for "platform independent interactive graphics" with VNC

2011-02-06 Thread C K Kashyap
> > After pulling in your changes and recompilation, your application runs > as expected. Thanks a lot! > > I look forward to some feedback on this. Also, I am thinking in the lines of changing the image representation in a "list" to a mutable array - would that be the right approach? Regards, K

Re: [Haskell-cafe] Extending GHCi

2011-02-06 Thread C K Kashyap
> > > > What part of that doesn't already work? You can forkIO threads in GHCi, > you can listen on the network. If you have written the server so it can be > controlled from another thread, you can run those controlling functions > at the prompt while the server is working. > > > Thanks Brandon .

  1   2   3   >