Re: [Haskell-cafe] Global Arrays

2012-03-09 Thread Alexandr Alexeev
>> what's the canonical way of declaring a top-level array Did you try State/StateT monads? 10 марта 2012 г. 5:05 пользователь John Meacham написал: > On Fri, Mar 9, 2012 at 5:49 PM, Clark Gaebel > wrote: > > What's the advantage of using D.A.Storable over D.Vector? And yes, > > good call with

Re: [Haskell-cafe] network-conduit proxy

2012-03-09 Thread grant
Excellent. registering killThread works great. Hopefully the library will be fixed correctly. Thanks a lot for your help, Grant ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] network-conduit proxy

2012-03-09 Thread Alexander V Vershilov
As it seems from code runTCPServer registers socket close and TCPClient runs it in bracket so all open resources should be closed. It my last try I add _ <- register $ killThread tId after forking serverSrc $$ clientSink, to kill outter thread explicilty otherwise it closes thread with error.

Re: [Haskell-cafe] network-conduit proxy

2012-03-09 Thread grant
I've tried running the code with runTCPServer first but I get "recv: invalid argument (Bad file descriptor)" on ubuntu (virtualbox) and when running on windows I get "Network.Socket.ByteString.recv: failed (Unknown error)". Also, it seems odd that when I run this code https://gist.github.com/

Re: [Haskell-cafe] ANNOUNCE: pipes-core 0.0.1

2012-03-09 Thread Mario Blažević
On 12-03-09 07:36 PM, Paolo Capriotti wrote: I'm pleased to announce the release of version 0.0.1 of pipes-core, a library for efficient, safe and compositional IO, similar in scope to iteratees and conduits. I like your design, it seems to strike a good balance between elegance and practi

Re: [Haskell-cafe] Global Arrays

2012-03-09 Thread John Meacham
On Fri, Mar 9, 2012 at 5:49 PM, Clark Gaebel wrote: > What's the advantage of using D.A.Storable over D.Vector? And yes, > good call with creating an array of HSDouble directly. I didn't think > of that! Oh, looks like D.Vector has an unsafeFromForeignPtr too, I didn't see that. so D.Vector shou

Re: [Haskell-cafe] Global Arrays

2012-03-09 Thread Clark Gaebel
What's the advantage of using D.A.Storable over D.Vector? And yes, good call with creating an array of HSDouble directly. I didn't think of that! On Fri, Mar 9, 2012 at 8:25 PM, John Meacham wrote: > On Fri, Mar 9, 2012 at 12:48 PM, Clark Gaebel > wrote: >> static const double globalArray[] = {

Re: [Haskell-cafe] Global Arrays

2012-03-09 Thread John Meacham
On Fri, Mar 9, 2012 at 12:48 PM, Clark Gaebel wrote: > static const double globalArray[] = { huge list of doubles }; > double* getGlobalArray() { return globalArray; } > int        getGlobalArraySize() { return > sizeof(globalArray)/sizeof(globalArray[0]); } > > And importing it in haskell witht h

[Haskell-cafe] ANNOUNCE: pipes-core 0.0.1

2012-03-09 Thread Paolo Capriotti
I'm pleased to announce the release of version 0.0.1 of pipes-core, a library for efficient, safe and compositional IO, similar in scope to iteratees and conduits. http://hackage.haskell.org/package/pipes-core This is a reimplementation of the original 'Pipe' concept by Gabriel Gonzales. The pack

Re: [Haskell-cafe] Global Arrays

2012-03-09 Thread Lyndon Maydwell
Could template-Haskell be used somehow? - Lyndon Maydwell On Mar 10, 2012 4:50 AM, "Clark Gaebel" wrote: > In Haskell, what's the canonical way of declaring a top-level array > (Data.Vector of a huge list of doubles, in my case)? Performance is > key in my case. > > The straightforward way would

[Haskell-cafe] Global Arrays

2012-03-09 Thread Clark Gaebel
In Haskell, what's the canonical way of declaring a top-level array (Data.Vector of a huge list of doubles, in my case)? Performance is key in my case. The straightforward way would just be something like: globalArray :: V.Vector Double globalArray = V.fromList [ huge list of doubles ] {-# NOINLI

Re: [Haskell-cafe] network-conduit proxy

2012-03-09 Thread Alexander V Vershilov
For first error it seems best way will be patching conduit-network as it done it warp [1]. I don't know how to deal with second error. [1] http://hackage.haskell.org/packages/archive/warp/1.1.0.1/doc/html/src/Network-Wai-Handler-Warp.html#runSettings -- Alexander V Vershilov Fri, Mar 09, 201

Re: [Haskell-cafe] network-conduit proxy

2012-03-09 Thread grant
When I run the code you suggested on windows I get the following error: getAddrInfo: does not exist (error 10093) which probably refers to http://trac.haskell.org/network/ticket/32 After adding withSocketsDo I get a little further, but get the following error after sending data through the pro

Re: [Haskell-cafe] network-conduit proxy

2012-03-09 Thread Alexander V Vershilov
Hello. I'm not expert but first you should not use Network sockets, because everything is included into Data.Conduit.Network, just use high level API. Second, you should use not server inside client but client inside server: so you can make such a code [1]: {-# OPTIONS -Wall #-} import Data.Con

[Haskell-cafe] ANNOUNCE: diagrams 0.5

2012-03-09 Thread Brent Yorgey
I am pleased to announce the release of version 0.5 of diagrams [1], a full-featured framework and embedded domain-specific language for declarative drawing. Check out the gallery [2] for examples of what it can do! [1] http://projects.haskell.org/diagrams [2] http://projects.haskell.org/diagrams/

[Haskell-cafe] network-conduit proxy

2012-03-09 Thread grant
I am trying to get a proxy working using the network-conduit package on windows. So I send a request to port 5002 and that gets forwarded to another port 5000 where I have a simple echo server running. I made a stab at it, but get intermittent send errors after the first connection Here is the c

Re: [Haskell-cafe] ANNOUNCE: string-conversions-0.2

2012-03-09 Thread Sönke Hahn
I've uploaded a new version to hackage incorporating suggestions from Joachim Breitner, Michael Snoyman and (offlist) Matthias Fischmann. The package now supplies (<>), a generic function for string concatenation. (Under ghc >= 7.4 this is a re-export from Data.Monoid to avoid name clashes.) Sö

Re: [Haskell-cafe] ANNOUNCE: string-conversions-0.1

2012-03-09 Thread Michael Snoyman
On Fri, Mar 9, 2012 at 4:36 PM, Sönke Hahn wrote: > Michael Snoyman wrote: >> I'm the author of convertible-text, and I consider it deprecated (it's >> marked as such in the synopsis). >> >> As far as string-conversions, I'm a little concerned that it's using >> decodeUtf8, which can throw excepti

Re: [Haskell-cafe] ANNOUNCE: string-conversions-0.1

2012-03-09 Thread Sönke Hahn
Michael Snoyman wrote: > I'm the author of convertible-text, and I consider it deprecated (it's > marked as such in the synopsis). > > As far as string-conversions, I'm a little concerned that it's using > decodeUtf8, which can throw exceptions from pure code for invalid UTF8 > sequences. I would

Re: [Haskell-cafe] ANNOUNCE: string-conversions-0.1

2012-03-09 Thread Sönke Hahn
Hi Joachim! Joachim Breitner wrote: > you could elaborate the documenatation “Assumes UTF-8” – I guess this > only applies to the two ByteString variants, as String and Text _should_ > contain unicode codepoints and no encoding. Not that someone tries to > use a String where each Char corresponds

Re: [Haskell-cafe] If you'd design a Haskell-like language, what would you do different?

2012-03-09 Thread Heinrich Apfelmus
Jerzy Karczmarczuk wrote: Well... Personally I hate thinking about bottom as "value". I don't do this. I NEVER teach that. And, I am a "lazy guy", almost all my Haskell programs are strongly based on laziness. I'll tell you what I teach, and you might throw some tomatoes... "The fundamental thin

Re: [Haskell-cafe] If you'd design a Haskell-like language, what would you do different?

2012-03-09 Thread Ketil Malde
Jerzy Karczmarczuk writes: > and the source of it power" - if I might cite you - is that we don't see > the difference between an object and the process which creates it. Interestingly, according to Wikipedia's article on "type system": A type system associates a type with each computed value

Re: [Haskell-cafe] ANNOUNCE: string-conversions-0.1

2012-03-09 Thread Joachim Breitner
Hi, Am Freitag, den 09.03.2012, 13:44 +0200 schrieb Michael Snoyman: > On Fri, Mar 9, 2012 at 1:40 PM, Joachim Breitner > wrote: > > > > I was about to suggest to merge this into the convertible package (to > > fight package proliferation), but found that it seems it is already > > there: > > htt

Re: [Haskell-cafe] ANNOUNCE: string-conversions-0.1

2012-03-09 Thread Joachim Breitner
Hi, Am Freitag, den 09.03.2012, 13:44 +0200 schrieb Michael Snoyman: > On Fri, Mar 9, 2012 at 1:40 PM, Joachim Breitner > wrote: > > > > I was about to suggest to merge this into the convertible package (to > > fight package proliferation), but found that it seems it is already > > there: > > htt

Re: [Haskell-cafe] ANNOUNCE: string-conversions-0.1

2012-03-09 Thread Michael Snoyman
On Fri, Mar 9, 2012 at 1:40 PM, Joachim Breitner wrote: > Hi Sönke, > > Am Freitag, den 09.03.2012, 11:17 +0100 schrieb Sönke Hahn: >> Any comments welcome. > > you could elaborate the documenatation “Assumes UTF-8” – I guess this > only applies to the two ByteString variants, as String and Text _

Re: [Haskell-cafe] ANNOUNCE: string-conversions-0.1

2012-03-09 Thread Joachim Breitner
Hi Sönke, Am Freitag, den 09.03.2012, 11:17 +0100 schrieb Sönke Hahn: > Any comments welcome. you could elaborate the documenatation “Assumes UTF-8” – I guess this only applies to the two ByteString variants, as String and Text _should_ contain unicode codepoints and no encoding. Not that someone

Re: [Haskell-cafe] If you'd design a Haskell-like language, what would you do different?

2012-03-09 Thread Jerzy Karczmarczuk
John Meacham : > The fact that bottom is a value in Haskell is the fundamental thing that > differentiates Haskell from other languages and the source of its power. The > fact that f _|_ /= _|_ potentially _is_ what it means to be a lazy language. > Not treating > _|_ as a value would be a huge di

[Haskell-cafe] ANNOUNCE: string-conversions-0.1

2012-03-09 Thread Sönke Hahn
Hi all! string-conversions is a very simple package to facilitate dealing with different string types. It provides a simple type class that allows you to convert between values of different string types. It also provides type synonyms for these string types. Supported types are: - String - St