Re: [Haskell-cafe] more gtk help

2013-08-13 Thread Brandon Allbery
On Tue, Aug 13, 2013 at 10:45 PM, wrote: > fooBar = > do putStrLn "foo" >return True > > so then I thought, aha!, all I need to do is understand the type of > "return True" and all will be revealed to me. Well, it's this: > > Control.Monad.Trans.Reader.ReaderT >(GHC.Ptr.Ptr

Re: [Haskell-cafe] more gtk help

2013-08-13 Thread briand
On Mon, 12 Aug 2013 14:50:43 +0100 Claude Heiland-Allen wrote: > Hi Brian, > > On 12/08/13 03:52, bri...@aracnet.com wrote: > ... > > Couldn't match expected type > ... > > Gtk.on Gtk.exposeEvent glCanvas $ \ _ -> putStrLn "foo" > ... > > I looked up the type of Gtk.on and exposeEvent

Re: [Haskell-cafe] more gtk help

2013-08-12 Thread Claude Heiland-Allen
Hi Brian, On 12/08/13 03:52, bri...@aracnet.com wrote: ... > Couldn't match expected type ... > Gtk.on Gtk.exposeEvent glCanvas $ \ _ -> putStrLn "foo" ... > I looked up the type of Gtk.on and exposeEvent : ... > on > :: object > -> Signal object callback -> callback -> IO (Connec

[Haskell-cafe] more gtk help

2013-08-11 Thread briand
n. The type of the entry widget callback is much simpler, and quite a bit different, so I it's of little help. I'm having a hard time finding appropriate examples because everything seems to use the deprecated convention of on{eventType}, e.g. onExposeEvent or onButtonPress. I was hopin

Re: [Haskell-cafe] Music / MIDI help

2013-07-11 Thread Heinrich Apfelmus
Mark Lentczner wrote: I'm a little lost in the bewildering array of music packages for Haskell, and need some help. I'm looking to recreate one of my algorithmic music compositions from the 1980s. I can easily code the logic in Haskell. I'm looking for a the right set of pac

Re: [Haskell-cafe] Music / MIDI help

2013-07-10 Thread Brent Yorgey
Maybe Euterpea? http://haskell.cs.yale.edu/euterpea/download/ On Wed, Jul 10, 2013 at 08:20:08AM -0700, Mark Lentczner wrote: > I'm a little lost in the bewildering array of music packages for Haskell, > and need some help. > > I'm looking to recreate one of my algorith

Re: [Haskell-cafe] Music / MIDI help

2013-07-10 Thread Anton Kholomiov
Mark Lentczner > I'm a little lost in the bewildering array of music packages for Haskell, > and need some help. > > I'm looking to recreate one of my algorithmic music compositions from the > 1980s. I can easily code the logic in Haskell. > > I'm looking for a

[Haskell-cafe] Music / MIDI help

2013-07-10 Thread Mark Lentczner
I'm a little lost in the bewildering array of music packages for Haskell, and need some help. I'm looking to recreate one of my algorithmic music compositions from the 1980s. I can easily code the logic in Haskell. I'm looking for a the right set of packages and SW so that I c

[Haskell-cafe] Who uses Travis CI and can help write a cookbook for those guys?

2013-06-28 Thread Ryan Newton
The Travis folks have decided they want to support Haskell better (multiple compiler versions): https://github.com/travis-ci/travis-ci/issues/882#issuecomment-20165378 (Yay!) They're asking for someone to help them up with setup scripts. They mention their cookbook collection here:

[Haskell-cafe] [OT]Help with translating Error Monads to C++

2013-06-24 Thread Larry Evans
Currently in the c++ developers ml, there's a discussion of a proposed Expected or an Either template: http://article.gmane.org/gmane.comp.lib.boost.devel/242496 A lot of the discussion appears, at least to me, to not be aware of how haskell handles similar situations. The above link was to my p

Re: [Haskell-cafe] Help me understand general recursion from cata- and anamorphism

2013-06-23 Thread Takayuki Muranushi
Dear all, https://github.com/nushio3/practice/blob/master/recursion-schemes/FibTest.hs After learning fix-point operators, I found an answer by myself. ``` fibBase :: (Integer -> Integer) -> Integer -> Integer fibBase fib n | n <= 1= 1 | otherwise = fib (n-1) + fib (n-2) fibWithFix ::

[Haskell-cafe] Help me understand general recursion from cata- and anamorphism

2013-06-16 Thread Takayuki Muranushi
In an attempt to understand why cata- and anamorphisms are considered so important, I found multiple implications that you can write any recursive functions in terms of nonrecursive functions and ana, cata (am I right here?) so I'm trying to practice the rewrite by a few functions. I'm following a

Re: [Haskell-cafe] help understanding zlib space leak

2013-05-05 Thread diego souza
Sorry, I should've removed the pid number from the output. The following should be correct: > $ sudo dd if=/dev/sda bs=4K count=2048K | ./test +RTS -M1M -s >/dev/null > ... 8589934592 bytes (8.6 GB) copied, 243.525 s, 35.3 MB/s 41,942,119,192

[Haskell-cafe] help understanding zlib space leak

2013-05-05 Thread diego souza
Dear haskellers, I'd like assistance figuring out a strange space leak using zlib package. To make it easier to reproduce I've come up with the following snippet that pretty much resumes up the problem I'm trying to solve: > -- omitting imports and function signatures > encode = compress . L.fro

Re: [Haskell-cafe] Request for help: Recompile of ghc producing "...-ghc7.4.2.so"s, which break project builds.

2013-04-27 Thread Brandon Allbery
On Sat, Apr 27, 2013 at 11:47 AM, David Banas wrote: > dbanas@dbanas-lap:~/prj/AMI-Tool$ make > rm -f libami.so > ghc -o libami.so -shared -dynamic -package parsec -lHSrts -lm -lffi -lrt > AMIParse.o AMIModel.o ami_model.o ExmplUsrModel.o Filter.o > dbanas@dbanas-lap:~/prj/AMI-Tool$ > > > However

Re: [Haskell-cafe] Request for help: Recompile of ghc producing "...-ghc7.4.2.so"s, which break project builds.

2013-04-27 Thread David Banas
I am able to fix my build problem, by creating a link to * libHSrts-ghc7.4.2.so, *named *libHSrts.so*: dbanas@dbanas-lap:~/prj/AMI-Tool$ ll /usr/lib/ghc-7.4.2/libHSrts* -rw-r--r-- 1 root root 980950 Apr 23 20:08 /usr/lib/ghc-7.4.2/libHSrts.a {snip} -rwxr-xr-x 1 root root 429218 Apr 23 20:08 /us

[Haskell-cafe] Request for help: Recompile of ghc producing "...-ghc7.4.2.so"s, which break project builds.

2013-04-27 Thread Captain Freako
Recently, I had to recompile ghc, in order to get the "-dyn" versions of the standard libraries installed. (The standard Ubuntu 12.10 64-bit Linux distribution doesn't include them in its "haskell-platform" package, and you can't upgrade "base" using the normal "cabal iinstall" approach, from what

[Haskell-cafe] Request for help with shared object link failure, involving relocation and -fPIC.

2013-04-24 Thread Captain Freako
Can anyone help me solve this link failure? ghc -o libami.so -shared -package parsec -lHSrts -lm -lffi -lrt AMIParse.o AMIModel.o ami_model.o ExmplUsrModel.o Filter.o /usr/bin/ld: /usr/lib/ghc-7.4.2/libHSrts.a(RtsAPI.o): relocation R_X86_64_32S against `ghczmprim_GHCziTypes_Czh_con_info' ca

Re: [Haskell-cafe] File I/O benchmark help (conduit, io-streams and Handle)

2013-03-09 Thread Michael Snoyman
you checked that the file copy is being done? >> * Copying a 1MB file in 1ms gives a throughput of ~1GB/s. The other >> >> methods have a more believable ~70MB/s throughput. >> >> G >> >> >> On Fri, Mar 8, 2013 at 7:30 AM, Michael Snoyman > <mail

Re: [Haskell-cafe] File I/O benchmark help (conduit, io-streams and Handle)

2013-03-09 Thread John Lato
oughput of ~1GB/s. The other >> >> methods have a more believable ~70MB/s throughput. >> >> G >> >> >> On Fri, Mar 8, 2013 at 7:30 AM, Michael Snoyman > <mailto:mich...@snoyman.com>> wrote: >> >> Hi all, >> >>

Re: [Haskell-cafe] File I/O benchmark help (conduit, io-streams and Handle)

2013-03-08 Thread Simon Marlow
ughput. G On Fri, Mar 8, 2013 at 7:30 AM, Michael Snoyman mailto:mich...@snoyman.com>> wrote: Hi all, I'm turning to the community for some help understanding some benchmark results[1]. I was curious to see how the new io-streams would work with conduit, as it looks like

Re: [Haskell-cafe] File I/O benchmark help (conduit, io-streams and Handle)

2013-03-08 Thread Michael Snoyman
That demonstrated the issue: I'd forgotten to pass O_TRUNC to the open system call. Adding that back makes the numbers much more comparable. Thanks for the input everyone, and Gregory for finding the actual problem (as well as pointing out a few other improvements). On Fri, Mar 8, 2013 at 12:13

Re: [Haskell-cafe] File I/O benchmark help (conduit, io-streams and Handle)

2013-03-08 Thread Gregory Collins
Something must be wrong with the conduit "NoHandle" code. I increased the filesize to 60MB and implemented the copy loop in pure C, the code and results are here: https://gist.github.com/gregorycollins/5115491 Everything but the conduit NoHandle code runs in roughly 600-620ms, including the pure

Re: [Haskell-cafe] File I/O benchmark help (conduit, io-streams and Handle)

2013-03-08 Thread Alexander Kjeldaas
On Fri, Mar 8, 2013 at 9:53 AM, Gregory Collins wrote: > On Fri, Mar 8, 2013 at 9:48 AM, John Lato wrote: > >> For comparison, on my system I get >> $ time cp input.dat output.dat >> >> real 0m0.004s >> user 0m0.000s >> sys 0m0.000s >> > > Does your workstation have an SSD? Michael's using a spin

Re: [Haskell-cafe] File I/O benchmark help (conduit, io-streams and Handle)

2013-03-08 Thread Gregory Collins
On Fri, Mar 8, 2013 at 9:48 AM, John Lato wrote: > For comparison, on my system I get > $ time cp input.dat output.dat > > real 0m0.004s > user 0m0.000s > sys 0m0.000s > Does your workstation have an SSD? Michael's using a spinning disk. -- Gregory Collins ___

Re: [Haskell-cafe] File I/O benchmark help (conduit, io-streams and Handle)

2013-03-08 Thread John Lato
y, although >you said you checked that the file copy is being done? >- Copying a 1MB file in 1ms gives a throughput of ~1GB/s. The other >methods have a more believable ~70MB/s throughput. > > G > > > On Fri, Mar 8, 2013 at 7:30 AM, Michael Snoyman wrote: > &g

Re: [Haskell-cafe] File I/O benchmark help (conduit, io-streams and Handle)

2013-03-08 Thread Gregory Collins
u said you checked that the file copy is being done? - Copying a 1MB file in 1ms gives a throughput of ~1GB/s. The other methods have a more believable ~70MB/s throughput. G On Fri, Mar 8, 2013 at 7:30 AM, Michael Snoyman wrote: > Hi all, > > I'm turning to the com

Re: [Haskell-cafe] File I/O benchmark help (conduit, io-streams and Handle)

2013-03-08 Thread Gregory Collins
On Fri, Mar 8, 2013 at 9:36 AM, Gregory Collins wrote: > I presume you did some Handle debugging? ...and here I mean "benchmarking" of course. -- Gregory Collins ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/

Re: [Haskell-cafe] File I/O benchmark help (conduit, io-streams and Handle)

2013-03-07 Thread John Lato
gap comes exclusively from sinkFile > vs sinkFileNoHandle. This makes me think that it might be a buffer copy > that's causing the slowdown, in which case the benchmark may in fact be > accurate. > On Mar 8, 2013 8:30 AM, "Michael Snoyman" wrote: > >> Hi all, >&

Re: [Haskell-cafe] File I/O benchmark help (conduit, io-streams and Handle)

2013-03-07 Thread Michael Snoyman
urate. On Mar 8, 2013 8:30 AM, "Michael Snoyman" wrote: > Hi all, > > I'm turning to the community for some help understanding some benchmark > results[1]. I was curious to see how the new io-streams would work with > conduit, as it looks like a far saner low-level ap

[Haskell-cafe] File I/O benchmark help (conduit, io-streams and Handle)

2013-03-07 Thread Michael Snoyman
Hi all, I'm turning to the community for some help understanding some benchmark results[1]. I was curious to see how the new io-streams would work with conduit, as it looks like a far saner low-level approach than Handles. In fact, the API is so simple that the entire wrapper is just a few

Re: [Haskell-cafe] Help to write type-level function

2013-02-27 Thread Dmitry Kulagin
Oh, that is my fault - I was sure that I specified the extension and it didn't help. It really works with Overlapping&Undecidable. Thank you! On Wed, Feb 27, 2013 at 10:36 PM, Aleksey Khudyakov < alexey.sklad...@gmail.com> wrote: > On 27.02.2013 17:35, Dmitry Kulagin wrot

Re: [Haskell-cafe] Help to write type-level function

2013-02-27 Thread Aleksey Khudyakov
On 27.02.2013 17:35, Dmitry Kulagin wrote: Hi Aleksey, Unfortunately, your solution does not work for me (ghc 7.6.2). I reduced the problem to: -- | Type class for type equality. class TypeEq (a :: α) (b :: α) (eq :: Bool) | a b -> eq instance TypeEq a a True -- instance TypeEq a

Re: [Haskell-cafe] Help to write type-level function

2013-02-27 Thread Dmitry Kulagin
Hi Aleksey, Unfortunately, your solution does not work for me (ghc 7.6.2). I reduced the problem to: -- | Type class for type equality. class TypeEq (a :: α) (b :: α) (eq :: Bool) | a b -> eq instance TypeEq a a True -- instance TypeEq a b False instance eq ~ False => TypeEq a b eq

Re: [Haskell-cafe] Help to write type-level function

2013-02-27 Thread Dmitry Kulagin
Very clear solution, I will try to adopt it. Thank you! On Wed, Feb 27, 2013 at 12:17 PM, Aleksey Khudyakov < alexey.sklad...@gmail.com> wrote: > On 27 February 2013 12:01, Raphael Gaschignard wrote: > > I think it might be impossible with type families. I don't think it's > > possible to diff

Re: [Haskell-cafe] Help to write type-level function

2013-02-27 Thread Dmitry Kulagin
That seems to be very relevant to my problem (especially HList.Record). Am I right that UndecidableInstances is required mostly because of eq on types, like in this instances: class HRLabelSet (ps :: [*]) instance HRLabelSet '[] instance HRLabelSet '[x] instance ( HEq l1 l2 leq , HRLabe

[Haskell-cafe] Help to write type-level function

2013-02-27 Thread oleg
Dmitry Kulagin wrote: > I try to implement typed C-like structures in my little dsl. HList essentially had those http://code.haskell.org/HList/ > I was unable to implement required type function: > type family Find (s :: Symbol) (xs :: [(Symbol,Ty)]) :: Ty > Which just finds a type in a

Re: [Haskell-cafe] Help to write type-level function

2013-02-27 Thread Aleksey Khudyakov
On 27 February 2013 12:01, Raphael Gaschignard wrote: > I think it might be impossible with type families. I don't think it's > possible to differentiate with type families something like T a a, and T a > b, with b different from a. > It's indeed impossible to write such type function using type f

Re: [Haskell-cafe] Help to write type-level function

2013-02-27 Thread Raphael Gaschignard
I think it might be impossible with type families. I don't think it's possible to differentiate with type families something like T a a, and T a b, with b different from a. I think that you would need overlap to write this. Here's

[Haskell-cafe] Help to write type-level function

2013-02-26 Thread Dmitry Kulagin
Hi, I try to implement typed C-like structures in my little dsl. I was able to express structures using type-level naturals (type Ty is promoted): > data Ty = TInt | TBool | TStruct Symbol [Ty] That allowed to implement all needed functions, including type-level function: > type family Get (n :

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

2013-02-23 Thread C K Kashyap
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 Kashyap wrote: > >> Thank you so much Vincent, >> >> I think thi

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
Thank you so much Vincent, I think this is what I need ... I tried to use it to connect to a local web server running in 443 - http://hpaste.org/82943 however, I get the following error - ssl_client.hs: connect: failed (Connection refused (WSAECONNREFUSED)) Am I missing something? Regards, Kash

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

2013-02-23 Thread C K Kashyap
What I am looking to achieve is - create a DLL that would do the complete gmail thing that could be linked to a standard C program (on windows) and could be used to download emails from gmail. What I gathered from HsOpenSSL (which is required for HaskellNet) depends on some native ssl dll That

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

2013-02-23 Thread Vincent Hanquez
On 02/23/2013 03:28 PM, C K Kashyap wrote: 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 Your example look odd, Typically yo

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

2013-02-23 Thread Vincent Hanquez
On 02/23/2013 09:05 PM, Brandon Allbery wrote: On Sat, Feb 23, 2013 at 1:58 PM, C K Kashyap wrote: What I am really looking for is a small sample code that demonstrates how TLS package can be used to connect to a webserver or imapserver. TLS isn't actually SSL, despite SSL getting blessed as

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

2013-02-23 Thread Jason Dusek
2013/2/23 C K Kashyap : > 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. Why does this requirement compel you to forego the imapget or HaskellNet packages? -- Jason Dusek pgp // solidsnack // C1EBC57DC55144F35460C8DF1FD4C6C1FE

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

2013-02-23 Thread Vincent Hanquez
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 looking for is a small sample code that demonstrates how TLS package can be used to connect to a webserver or imapserver

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

2013-02-23 Thread Brandon Allbery
IMAP is somewhat harder than SMTP; I suggest you read up on the protocol. I've done a fair amount of work with it, and still would have to refer to the RFC to establish a connection without the help of an existing IMAP library. -- brandon s allbery kf8nh sine nom

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

2013-02-23 Thread C K Kashyap
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 looking for is a small sample code that demonstrates how TLS package can be used to connect to a webserver or imapserver. Regards, Kashyap On Sat, Feb 23, 2013 at

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

2013-02-23 Thread satvik chauhan
You can use HaskellNet or imapget directly or look into their source code for connecting to imap manually. -Satvik On Sat, Feb 23, 2013 at 8:58 PM, C K Kashyap wrote: > Hi, > > I am trying to use Haskel

[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] help diagnosing space leak with IORef/STRef, just incrementing a million times.

2013-01-06 Thread Christopher Done
A similar use-case and same solution with IORefs: http://hpaste.org/diff/80055/80058 Guess which one threw a stackoverflow and which one ran indefinitely when given a few hundred million lines of input. On 7 January 2013 07:35, Albert Y. C. Lai wrote: > On 13-01-07 12:12 AM, Thomas Hartman wrote:

[Haskell-cafe] help diagnosing space leak with IORef/STRef, just incrementing a million times.

2013-01-06 Thread Thomas Bereknyei
I have had issues like this with modifySTRef before. Try to make a strict version modifySTRef' If memory serves, something like this worked for me. modifySTRef' r f = do a <- readSTRef r writeSTRef r $! f a ___ Haskell-Cafe mailing list Haskell

Re: [Haskell-cafe] help diagnosing space leak with IORef/STRef, just incrementing a million times.

2013-01-06 Thread Albert Y. C. Lai
On 13-01-07 12:12 AM, Thomas Hartman wrote: I have a space leak in a function that increments a number inside IORef or STRef (either lazy or strict). IORef and STRef operations do not automatically evaluate contents. "writeIORef r (x + 1)" simply stores a pointer to the expression (thunk) "x

[Haskell-cafe] Fwd: Foreign.Erlang help

2013-01-03 Thread Junior White
Hi Alexandar, Thanks for your help! I give up Foreign.Erlang and try usual tcp server in Haskell instead. -- Forwarded message -- From: Junior White Date: Fri, Jan 4, 2013 at 3:18 PM Subject: Re: [Haskell-cafe] Foreign.Erlang help To: Alexander Alexeev Hi Alexandar, Thanks

Re: [Haskell-cafe] Foreign.Erlang help

2012-12-25 Thread Alexander Alexeev
First of all, you can write usual TCP server in Haskell and use it from Erlang. It would be handy to use some widely used protocol, like Memcached or Redis. If in some reason you want to use Foreign.Erlang, make sure that you are using the same cookie and the same node name type (short or full

[Haskell-cafe] Foreign.Erlang help

2012-12-24 Thread Junior White
Hi all, I have a game server programming in erlang, but now i want to write some game logic in haskell, how to write a haskell node for erlang? ps:I have read the introduce of Foreign.Erlang,I use haskell send a message to a erlang echo server, but the server not receive anything.

Re: [Haskell-cafe] Help optimize fannkuch program

2012-12-08 Thread Branimir Maksimovic
Here it is :http://shootout.alioth.debian.org/u64/program.php?test=fannkuchredux&lang=ghc&id=4 Date: Mon, 3 Dec 2012 15:32:20 -0800 Subject: Re: [Haskell-cafe] Help optimize fannkuch program From: b...@serpentine.com To: bm...@hotmail.com CC: haskell-cafe@haskell.org On Mon, Dec 3, 20

Re: [Haskell-cafe] Help optimize fannkuch program

2012-12-03 Thread Bryan O'Sullivan
On Mon, Dec 3, 2012 at 11:18 AM, Branimir Maksimovic wrote: > Thanks ! Should I contribute your version on shootout site? > Do whatever you like with it. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/hask

Re: [Haskell-cafe] Help optimize fannkuch program

2012-12-03 Thread Branimir Maksimovic
ing mine version.Thanks ! Should I contribute your version on shootout site? Date: Mon, 3 Dec 2012 00:01:32 -0800 Subject: Re: [Haskell-cafe] Help optimize fannkuch program From: b...@serpentine.com To: bm...@hotmail.com CC: haskell-cafe@haskell.org On Sun, Dec 2, 2012 at 3:12 PM, Branimir Maksimo

Re: [Haskell-cafe] Help optimize fannkuch program

2012-12-03 Thread Bryan O'Sullivan
On Sun, Dec 2, 2012 at 3:12 PM, Branimir Maksimovic wrote: > Well, playing with Haskell I have literally trasnlated my c++ program > > http://shootout.alioth.debian.org/u64q/program.php?test=fannkuchredux&lang=gpp&id=3 > and got decent performance but not that good in comparison > with c++ > On my

[Haskell-cafe] Help optimize fannkuch program

2012-12-02 Thread Branimir Maksimovic
Well, playing with Haskell I have literally trasnlated my c++ program http://shootout.alioth.debian.org/u64q/program.php?test=fannkuchredux&lang=gpp&id=3and got decent performance but not that good in comparisonwith c++ On my machine Haskell runs 52 secs while c++ 30 secs.(There is Haskell entr

Re: [Haskell-cafe] need help with understanding expression

2012-11-24 Thread damodar kulkarni
Hi, Thanks for the clarification. This is clearly depravity. I am confused, in what sense this is depravity? Damodar On Sun, Nov 18, 2012 at 7:27 AM, Albert Y. C. Lai wrote: > On 12-11-17 02:19 AM, damodar kulkarni wrote: > >> Let's see tthis: >> Prelude> :t 3 "a" >> 3 "a" :: (Num ([Char] ->

Re: [Haskell-cafe] need help with understanding expression

2012-11-17 Thread Albert Y. C. Lai
On 12-11-17 02:19 AM, damodar kulkarni wrote: Let's see tthis: Prelude> :t 3 "a" 3 "a" :: (Num ([Char] -> t)) => t No complaint from GHC; but now see this: Prelude> :t "a" 3 :1:0: Couldn't match expected type `t1 -> t' against inferred type `[Char]' In the expression: "a

Re: [Haskell-cafe] need help with understanding expression

2012-11-17 Thread MigMit
Отправлено с iPhone 17.11.2012, в 11:19, damodar kulkarni написал(а): > In the second case, why the GHC doesn't give something like? > ([Char] (a -> t), Num a) => t Because "Num" is a class of types, while "String" is a type. In other words, in the expression 3 "a" ghc doesn't know, what typ

Re: [Haskell-cafe] need help with understanding expression

2012-11-16 Thread damodar kulkarni
Let's see tthis: Prelude> :t 3 "a" 3 "a" :: (Num ([Char] -> t)) => t No complaint from GHC; but now see this: Prelude> :t "a" 3 :1:0: Couldn't match expected type `t1 -> t' against inferred type `[Char]' In the expression: "a" 3 Why does it not fail for (:t 3 "a") but does

Re: [Haskell-cafe] need help with understanding expression

2012-11-16 Thread Albert Y. C. Lai
On 12-11-16 02:10 AM, Daryoush Mehrtash wrote: I am having hard time understanding how removing the outer parenthesis in (max.(+1)) 2 2 to max.(+1) 2 2 changes the meaning of expression. I recommend http://bm380.user.srcf.net/prettyparsetree.cgi for discovering the correct parse. Specif

Re: [Haskell-cafe] need help with understanding expression

2012-11-16 Thread Sean Leather
Hi Daryoush, Prelude> :t 3 2 > 3 2 :: (Num a, Num (a -> t)) => t > > What does the type mean in plain english? > It's important to remember that numeric literals are polymorphic. That is, 3 :: Num a => a. They do not have monomorphic types such as Int or Integer. In the above, GHCi is inferring

Re: [Haskell-cafe] need help with understanding expression

2012-11-16 Thread Ramana Kumar
On Fri, Nov 16, 2012 at 8:00 AM, Daryoush Mehrtash wrote: > Sorry wrong paste > > Prelude> :t 3 2 > 3 2 :: (Num a, Num (a -> t)) => t > It means that 2 has type a (which must be in the Num class), 3 has type (a -> t) (which also must be in the Num class), and the type of (3 2) is therefore t. Whe

Re: [Haskell-cafe] need help with understanding expression

2012-11-16 Thread Daryoush Mehrtash
Sorry wrong paste Prelude> :t 3 2 3 2 :: (Num a, Num (a -> t)) => t What does the type mean in plain english? Daryoush On Fri, Nov 16, 2012 at 12:00 AM, Daryoush Mehrtash wrote: > Yes, same problem, and again I have no idea how to read the type > > Prelude> :t max. 3 2 > max. 3 2 :: (Ord b, N

Re: [Haskell-cafe] need help with understanding expression

2012-11-16 Thread Daryoush Mehrtash
Yes, same problem, and again I have no idea how to read the type Prelude> :t max. 3 2 max. 3 2 :: (Ord b, Num a1, Num (a1 -> a -> b)) => a -> b -> b What does the type mean in plain english? Daryoush On Thu, Nov 15, 2012 at 11:56 PM, Ramana Kumar wrote: > Another experiment may be revealing:

Re: [Haskell-cafe] need help with understanding expression

2012-11-15 Thread Ramana Kumar
Another experiment may be revealing: :t 3 2 On Fri, Nov 16, 2012 at 7:46 AM, Daryoush Mehrtash wrote: > I see the point with :t (.) that > > max.(+1) 2 2 > > is the same as > > max. 3 2 > > Which is not what I want. > > But I have no idea what the type signature of this expression mean now > >

Re: [Haskell-cafe] need help with understanding expression

2012-11-15 Thread Daryoush Mehrtash
I see the point with :t (.) that max.(+1) 2 2 is the same as max. 3 2 Which is not what I want. But I have no idea what the type signature of this expression mean now Prelude> :t max. 3 2 max. 3 2 :: (Ord b, Num a1, Num (a1 -> a -> b)) => a -> b -> b Any idea? Daryoush On Thu, Nov 15, 20

Re: [Haskell-cafe] need help with understanding expression

2012-11-15 Thread Ramana Kumar
Hi Daryoush, I recommend you try these experiments first, and then reply back if you're still confused. :t max :t (+1) :t max . (+1) :t (+1) 2 :t (.) On Fri, Nov 16, 2012 at 7:10 AM, Daryoush Mehrtash wrote: > I am having hard time understanding how removing the outer parenthesis in > > (

[Haskell-cafe] need help with understanding expression

2012-11-15 Thread Daryoush Mehrtash
I am having hard time understanding how removing the outer parenthesis in (max.(+1)) 2 2 to max.(+1) 2 2 changes the meaning of expression. My expectation was that "max.(+1) takes two numbers and returns the max as defined in the type: :t max.(+1) max.(+1) :: (Ord b, Num b) => b -> b -> b

Re: [Haskell-cafe] Help: Main: thread blocked in MVar operation

2012-11-04 Thread José A. Lopes
Hey, So, I couldn't really get a small code sample. But I have a new example of the same problem. Anyway, let me just give you the overall picture. I am building an interpreter and I want to evaluate the definition of a recursive function. This entails registering the function symbol in the symb

Re: [Haskell-cafe] Help: Main: thread blocked in MVar operation

2012-10-23 Thread Joey Adams
On Tue, Oct 23, 2012 at 5:03 PM, "José A. Lopes" wrote: > Hey everyone, > > I changed my code I now I get the following error message > Main: thread blocked indefinitely in an MVar operation > > Before the change, I was using the State monad with runState. > Then, I changed the code to use the

[Haskell-cafe] Help: Main: thread blocked in MVar operation

2012-10-23 Thread José A. Lopes
. And this change introduced the error message. BTW I am using DoRec extension, maybe it is the source of the problem, but I don't know. Here are some specs: ghc 7.4.2 mtl 2.1.1 If you need any other information please don't hesitate to ask. Any help is greatly appreciated! Cheers, Jos

[Haskell-cafe] Help me with space leaks

2012-09-25 Thread Alexey Uimanov
Hello. I am trying to write some thing in haskell and i need fast storage to store and select this things from storage. https://github.com/s9gf4ult/projs/tree/master/haskell/teststorage I am writing simple testing package to determine my needs and select the fastest storage and i have encountered

Re: [Haskell-cafe] Help a young graduate haskeller to land its dream job

2012-09-12 Thread Eugene Kirpichov
Hi Alfredo, You might look at the various bigdata companies. I was surprised by how many of them are using Scala or Clojure - it's definitely over 50%. Looks like FP is really gaining traction in this area. On Wed, Sep 12, 2012 at 11:48 AM, Alfredo Di Napoli wrote: > Hi everyone, > > If this mai

[Haskell-cafe] Help a young graduate haskeller to land its dream job

2012-09-12 Thread Alfredo Di Napoli
Hi everyone, If this mail sound strange to you, you are free to ignore it. My name is Alfredo Di Napoli and I'm a 24-year-old programmer from Rome, Italy. I've graduated in May and I'm currently working as an intern for a company involved in the defence field. In my spare time, though, I study f

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/**LearningPrograms/blob/master/**

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

2012-07-23 Thread Christian Maeder
Am 22.07.2012 17:21, schrieb C K Kashyap: I've updated the parser here - https://github.com/ckkashyap/LearningPrograms/blob/master/Haskell/Parsing/xml_3.hs The whole thing is less than 100 lines and it can handle comments as well. This code is still not nice: Duplicate code in openTag and wit

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 a ParseError. You > can extract the e

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

2012-07-22 Thread Antoine Latter
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 a ParseError. You can extract the error position with the 'errorPos' function, and then you can extract the name of the file from the position with 'sourc

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 Simon Hengel
> 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 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailma

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

2012-07-22 Thread C K Kashyap
I've updated the parser here - https://github.com/ckkashyap/LearningPrograms/blob/master/Haskell/Parsing/xml_3.hs The whole thing is less than 100 lines and it can handle comments as well. I have an outstanding question - What's the second parameter of the parse function really for? Regards, Kas

Re: [Haskell-cafe] System.Win32.Registry... Help?

2012-07-22 Thread Simon Peter Nicholls
Glad I could help. Win32 / FFI examples are indeed thin on the ground. As it's a null terminated string in that code, you'll need to add 1 to the length of "A" when calculating the byte count. Actually, speaking of Win32 examples, I'll drop a general Win32 UI hint

Re: [Haskell-cafe] System.Win32.Registry... Help?

2012-07-22 Thread Anonymous Void
op, lol. >> >> I found a mailing list post showing how to read registry keys and was >> able to make a function based off of it, >> but I have no idea what to put into some of the arguments for >> regSetValueEx or regCreateKeyEx, so I'm stuck. >> Also, what&#x

Re: [Haskell-cafe] System.Win32.Registry... Help?

2012-07-22 Thread Simon Peter Nicholls
based off of it, > but I have no idea what to put into some of the arguments for > regSetValueEx or regCreateKeyEx, so I'm stuck. > Also, what's the best way to recursively traverse trees in the > registry, are there any functions for it? > > Can someone please help

Re: [Haskell-cafe] System.Win32.Registry... Help?

2012-07-22 Thread Anonymous Void
Nvm, I figured it out.. aloccabytes with a partial function seems to work, I'll figure out the rest by messing with it. Thanks. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] System.Win32.Registry... Help?

2012-07-21 Thread Dave Buznik
-- Forwarded message -- From: Anonymous Void Date: Sun, Jul 22, 2012 at 2:10 AM Subject: Re: [Haskell-cafe] System.Win32.Registry... Help? To: Tim Matthews I've looked into their docs, but I can't for the life of me figure out how to convert a string to lptstr, f

Re: [Haskell-cafe] System.Win32.Registry... Help?

2012-07-21 Thread Tim Matthews
On Sun, Jul 22, 2012 at 5:43 PM, Tim Matthews wrote: > > > On Sun, Jul 22, 2012 at 5:11 PM, Anonymous Void wrote: > >> >> but I have no idea what to put into some of the arguments for >> regSetValueEx or regCreateKeyEx, >> > > Those are just plain bindings to windows function so refer to msdn >

[Haskell-cafe] System.Win32.Registry... Help?

2012-07-21 Thread Anonymous Void
showing how to read registry keys and was able to make a function based off of it, but I have no idea what to put into some of the arguments for regSetValueEx or regCreateKeyEx, so I'm stuck. Also, what's the best way to recursively traverse trees in the registry, are there any functions for i

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

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

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 sugg

  1   2   3   4   5   6   7   8   9   10   >