[Haskell-cafe] safe vs unsafe

2008-06-23 Thread Galchin, Vasili
Hello, At runtime, I am getting aio: schedule: re-entered unsafely. Perhaps a 'foreign import unsafe' should be 'safe'? I want to understand from an implementation viewpoint .. deeper. This is a GC issue yes? Kind regards, Vasili ___ Haske

[Haskell-cafe] Re: number-parameterized types and heterogeneous lists

2008-06-23 Thread oleg
Luke Palmer wrote in response to Harald ROTTER > > I also wonder if there is some kind of "generalized" foldr such that, e.g. > > D1 $ D0 $ D0 $ Sz = specialFoldr ($) Sz [D1,D0,D0] > > I think that this foldr must be some "special" foldr that augments the data > > type of the result in each f

Re: [Haskell-cafe] Re: "C" buffer suggestions??

2008-06-23 Thread David Roundy
See the Data.ByteString.Internal docs: http://www.haskell.org/ghc/docs/latest/html/libraries/bytestring/Data-ByteString-Internal.html#v%3AtoForeignPtr Of course, you'd better not write to the contents of that pointer, or bad things could happen... David On Mon, Jun 23, 2008 at 08:18:23PM -0500,

Re: [Haskell-cafe] Re: "C" buffer suggestions??

2008-06-23 Thread Galchin, Vasili
e.g. on Word8 . let aiocb = AIOCB{ aioFd=fd, aioLioOpcode=0, aioReqPrio=0, aioOffset=0, aioBuf=??,< Ptr Word8 aioByte

Re: [Haskell-cafe] Re: "C" buffer suggestions??

2008-06-23 Thread Galchin, Vasili
ok . 1) how do I marshall from ByteString to char * (poke)?? 2) how do I write let x =??? :: Word8 3) how do I write let y = ??? ::ByteString Kind regards, Vasili On Mon, Jun 23, 2008 at 6:13 PM, Adam Langley <[EMAIL PROTECTED]> wrote: > On Mon, Jun 23, 2008 at 2:27 P

Re: [Haskell-cafe] Help with generalizing function

2008-06-23 Thread Richard A. O'Keefe
On 23 Jun 2008, at 6:30 pm, leledumbo wrote: I've successfully create a function to return lists of N-ple that satisfy the following function: x1 + x2 + x3 + ... + xN = C But unfortunately, it's not generic. Why do you want it to be a tuple? All the elements are the same type, so it migh

Re: [Haskell-cafe] Re: "C" buffer suggestions??

2008-06-23 Thread Adam Langley
On Mon, Jun 23, 2008 at 2:27 PM, Don Stewart <[EMAIL PROTECTED]> wrote: > So heap allocated and collected, but not moved. My bad. In that case, you might want to work with ByteStrings all the way since it might make building the visible interface (which probably should use ByteStrings) easier. A

Re: [Haskell-cafe] number-parameterized types and heterogeneous lists

2008-06-23 Thread Ryan Ingram
Literate haskell response: > {-# LANGUAGE GADTs, RankNTypes #-} > module Digits where > {- On 6/23/08, Luke Palmer <[EMAIL PROTECTED]> wrote: > > I also wonder if there is some kind of "generalized" foldr such that, e.g. > > D1 $ D0 $ D0 $ Sz = specialFoldr ($) Sz [D1,D0,D0] > > I think that

Re: [Haskell-cafe] IMAP and NNTP libraries

2008-06-23 Thread John Goerzen
Adam Langley wrote: > On Sat, Jun 21, 2008 at 10:52 PM, Maurí­cio <[EMAIL PROTECTED]> wrote: >> Are there mature libraries for IMAP and NNTP >> available to Haskell? > > Pretty much, if a Haskell library exist it will be listed at [1]. > Since I don't see anything for IMAP, nor NNTP I can be prett

Re: [Haskell-cafe] IMAP and NNTP libraries

2008-06-23 Thread Don Stewart
agl: > On Sat, Jun 21, 2008 at 10:52 PM, Maurí­cio <[EMAIL PROTECTED]> wrote: > > Are there mature libraries for IMAP and NNTP > > available to Haskell? > > Pretty much, if a Haskell library exist it will be listed at [1]. > Since I don't see anything for IMAP, nor NNTP I can be pretty sure > that

Re: [Haskell-cafe] Re: "C" buffer suggestions??

2008-06-23 Thread Don Stewart
agl: > 2008/6/23 Galchin, Vasili <[EMAIL PROTECTED]>: > > Basically I want to model POSIX async io "aiocb"( > > http://uw714doc.sco.com/en/man/html.5/aiocb.5.html) in Haskell .. in > > particular the aiocb field "aio_buf"! > > That's a mutable buffer, so this has to be pretty low level in your > w

Re: [Haskell-cafe] IMAP and NNTP libraries

2008-06-23 Thread Chris Eidhof
On 23 jun 2008, at 22:26, Spencer Janssen wrote: On Sun, Jun 22, 2008 at 02:52:33AM -0300, Maurí cio wrote: Hi, Are there mature libraries for IMAP and NNTP available to Haskell? Thanks, Maurício There is the haskellnet project: http://darcs.haskell.org/SoC/haskellnet/ I'm not sure whe

Re: [Haskell-cafe] Re: "C" buffer suggestions??

2008-06-23 Thread Adam Langley
On Mon, Jun 23, 2008 at 1:15 PM, Galchin, Vasili <[EMAIL PROTECTED]> wrote: > I tried to write a test value of Word8 without success. Can you give an > example? I'm not quite sure what you would want in such an example. See [1] for the malloc function. Then you take the result and wrap it wi

Re: [Haskell-cafe] IMAP and NNTP libraries

2008-06-23 Thread Spencer Janssen
On Sun, Jun 22, 2008 at 02:52:33AM -0300, Maurí­cio wrote: > Hi, > > Are there mature libraries for IMAP and NNTP > available to Haskell? > > Thanks, > Maurício There is the haskellnet project: http://darcs.haskell.org/SoC/haskellnet/ I'm not sure whether it is mature or maintained. Cheers

Re: [Haskell-cafe] Re: "C" buffer suggestions??

2008-06-23 Thread Galchin, Vasili
On Mon, Jun 23, 2008 at 12:07 PM, Adam Langley <[EMAIL PROTECTED]> wrote: > 2008/6/23 Galchin, Vasili <[EMAIL PROTECTED]>: > > Basically I want to model POSIX async io "aiocb"( > > http://uw714doc.sco.com/en/man/html.5/aiocb.5.html) in Haskell .. in > > particular the aiocb field "aio_buf"! > > Th

Re: [Haskell-cafe] IMAP and NNTP libraries

2008-06-23 Thread Adam Langley
On Sat, Jun 21, 2008 at 10:52 PM, Maurí­cio <[EMAIL PROTECTED]> wrote: > Are there mature libraries for IMAP and NNTP > available to Haskell? Pretty much, if a Haskell library exist it will be listed at [1]. Since I don't see anything for IMAP, nor NNTP I can be pretty sure that the answer is "no"

Re: [Haskell-cafe] Re: "C" buffer suggestions??

2008-06-23 Thread Adam Langley
2008/6/23 Galchin, Vasili <[EMAIL PROTECTED]>: > Basically I want to model POSIX async io "aiocb"( > http://uw714doc.sco.com/en/man/html.5/aiocb.5.html) in Haskell .. in > particular the aiocb field "aio_buf"! That's a mutable buffer, so this has to be pretty low level in your wrapping of the AIO

Re: [Haskell-cafe] number-parameterized types and heterogeneous lists

2008-06-23 Thread Anton Tayanovskyy
Alfonso, Thanks! For didactic purposes I will defer looking into your code. It does not always help to know the correct solution :) Bests, --A On Mon, Jun 23, 2008 at 11:26 AM, Alfonso Acosta <[EMAIL PROTECTED]> wrote: > Inspired in Oleg's ideas, I implemented the packages type-level and > par

Re: [Haskell-cafe] Literal programming in Haskell with rst-literals

2008-06-23 Thread Darrin Thompson
2008/6/23 Abhay Parvate <[EMAIL PROTECTED]>: > Hello, > > You might already know this, but in case you don't: there is another > literate style: > I had trouble finding the docs on this, as I expected them to be in the ghc user guide. For the record, the relevant docs are in the h98 report: http:

Re: [Haskell-cafe] What is a rigid type variable?

2008-06-23 Thread Henning Thielemann
On Mon, 23 Jun 2008, Xiao-Yong Jin wrote: Thanks for the explanation. I guess it's just easier for me not to give any type signature to `go', since ghc should do the type inference quite nicely and reliably. If you want to stay Haskell98 'asTypeOf' can help you in similar cases.

RE: [Haskell-cafe] expected vs inferred type confusion

2008-06-23 Thread Bayley, Alistair
> From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Stephen Howard > > the error: > > renao.hs:6:4: > Couldn't match `HttpResponse' against `IO HttpResponse' > Expected type: IO HttpResponse > Inferred type: IO (IO HttpResponse) > In the expression: return $ (h

[Haskell-cafe] expected vs inferred type confusion

2008-06-23 Thread Stephen Howard
I am having issues with type signatures for the resourceHandler action below. I haven't figured out what I'm doing wrong to cause the wrong type to be returned. It looks like Haskell is inferring that I'm returning a function from this action, when from the type signature I've specified, that

Re: GSoC project blogs? (Re: [Haskell-cafe] Planet haskell)

2008-06-23 Thread Malcolm Wallace
> It would be nice to have blogs for all Haskell GSoC projects > on Planet Haskell. See also http://hackage.haskell.org/trac/summer-of-code/wiki/progress2008 Regards, Malcolm ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.hask

Re: Re[Haskell-cafe] [2]: Help with generalizing function

2008-06-23 Thread Jonathan Cast
On Mon, 2008-06-23 at 04:03 -0700, leledumbo wrote: > >> Don't give up so fast !! (Note that you can't do what you asked for in > >> Pascal either, in fact Pascal don't support n-uplet) > I'm not going to use n-uplet, dynamic array of array of Byte is enough. > Though not very optimizing, I can us

Re: GSoC project blogs? (Re: [Haskell-cafe] Planet haskell)

2008-06-23 Thread Antti-Juhani Kaijanaho
(I'd rather people did not send me copies of list posts.) On Mon, Jun 23, 2008 at 02:40:27PM +0100, Claus Reinke wrote: > It would be nice to have blogs for all Haskell GSoC projects > on Planet Haskell. Any such blogs would certainly qualify. Authors should read http://planet.haskell.org/policy

GSoC project blogs? (Re: [Haskell-cafe] Planet haskell)

2008-06-23 Thread Claus Reinke
It would be nice to have blogs for all Haskell GSoC projects on Planet Haskell. Infrequent updates (such as Neil's weekly summaries) would be quite okay - details can always be followed up in email, provided that interested parties are aware of them in the first place;-) Otherwise, we end up wit

Re: [Haskell-cafe] What is a rigid type variable?

2008-06-23 Thread Xiao-Yong Jin
"Luke Palmer" <[EMAIL PROTECTED]> writes: > On Mon, Jun 23, 2008 at 5:58 AM, Luke Palmer <[EMAIL PROTECTED]> wrote: >> On Mon, Jun 23, 2008 at 3:26 AM, Xiao-Yong Jin <[EMAIL PROTECTED]> wrote: >>> Hi all, >>> >>> I'm writing a short function as follows, but I'm not able to >>> find a suitable type

[Haskell-cafe] Re: ANNOUNCE: Pipe 1.0

2008-06-23 Thread Simon Marlow
Isaac Dupree wrote: Don Stewart wrote: Interesting. Does it depend on an unreleased version of the process library? by the way, is there a policy for when new versions of packages maintained by [EMAIL PROTECTED] are *released*? Or do patches just collect in the darcs repository until they'r

Re: [Haskell-cafe] Literal programming in Haskell with rst-literals

2008-06-23 Thread Abhay Parvate
Hello, You might already know this, but in case you don't: there is another literate style: ... non-code ... \begin{code} ... code ... \end{code} ... non-code ... in which you do not put prefixes to each line. (In fact the standard says somewhere it is not recommended to mix the two styles if I

Re: Re[Haskell-cafe] [2]: Help with generalizing function

2008-06-23 Thread leledumbo
>> Don't give up so fast !! (Note that you can't do what you asked for in >> Pascal either, in fact Pascal don't support n-uplet) I'm not going to use n-uplet, dynamic array of array of Byte is enough. Though not very optimizing, I can use 2 step process: 1. Generate all lists (array of Byte) of

Re: Re[Haskell-cafe] [2]: Help with generalizing function

2008-06-23 Thread leledumbo
>> Don't give up so fast !! (Note that you can't do what you asked for in >> Pascal either, in fact Pascal don't support n-uplet) I'm not going to use n-uplet, dynamic array of array of Byte is enough. Though not very optimizing, I can use 2 step process: 1. Generate all lists (array of Byte) of

Re: [Haskell-cafe] ANNOUNCE: Pipe 1.0

2008-06-23 Thread Isaac Dupree
Don Stewart wrote: Interesting. Does it depend on an unreleased version of the process library? by the way, is there a policy for when new versions of packages maintained by [EMAIL PROTECTED] are *released*? Or do patches just collect in the darcs repository until they're picked up by some m

Re[2]: [Haskell-cafe] Help with generalizing function

2008-06-23 Thread Bulat Ziganshin
Hello Chaddai, Monday, June 23, 2008, 1:42:25 PM, you wrote: >> I give up %-|, I'll go back to Pascal instead. Thanks for your answers. > findAllAns 0 0 = [[]] > findAllAns 0 s = [] > findAllAns n s = [ x:xs | x <- [0..s], xs <- findAllAns (n - 1) (s - x) ] seems that leledumbo found a new way

Re: [Haskell-cafe] Help with generalizing function

2008-06-23 Thread Chaddaï Fouché
2008/6/23 leledumbo <[EMAIL PROTECTED]>: > > I give up %-|, I'll go back to Pascal instead. Thanks for your answers. Don't give up so fast !! (Note that you can't do what you asked for in Pascal either, in fact Pascal don't support n-uplet) A recursive way to do it is : findAllAns 0 0 = [[]] fin

[Haskell-cafe] Re: "C" buffer suggestions??

2008-06-23 Thread Galchin, Vasili
Basically I want to model POSIX async io "aiocb"( http://uw714doc.sco.com/en/man/html.5/aiocb.5.html) in Haskell .. in particular the aiocb field "aio_buf"! Kind regards, Vasili On Sun, Jun 22, 2008 at 1:47 AM, Galchin, Vasili <[EMAIL PROTECTED]> wrote: > Hello, > > I want to model an I/O re

Re: [Haskell-cafe] Safe way to parse arguments?

2008-06-23 Thread Malcolm Wallace
> > I'm wondering how usually you parse command line arguments > > list safely. > > > > Prelude.read: no parse > > It's generally not a good idea to call 'read' on user data. There is (at least one) proper parsing library intended as a direct replacement for Read: http://www.cs.york.ac.uk/fp

Re: [Haskell-cafe] Help with generalizing function

2008-06-23 Thread leledumbo
I give up %-|, I'll go back to Pascal instead. Thanks for your answers. -- View this message in context: http://www.nabble.com/Help-with-generalizing-function-tp18063291p18065206.html Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com. __

Re: [Haskell-cafe] number-parameterized types and heterogeneous lists

2008-06-23 Thread Alfonso Acosta
Inspired in Oleg's ideas, I implemented the packages type-level and parameterized-data (which includes number-parameterized vectors). To get an idea about how they work you might want to read their haddock documentation in hackage: http://hackage.haskell.org/cgi-bin/hackage-scripts/package/type-

Re: [Haskell-cafe] Help with generalizing function

2008-06-23 Thread Luke Palmer
On Mon, Jun 23, 2008 at 6:30 AM, leledumbo <[EMAIL PROTECTED]> wrote: > I've successfully create a function to return lists of N-ple that satisfy the > following function: > x1 + x2 + x3 + ... + xN = C > But unfortunately, it's not generic. The N is supposed to be an input, too. > I don't know how

Re: [Haskell-cafe] Planet haskell

2008-06-23 Thread Antti-Juhani Kaijanaho
On Mon, Jun 23, 2008 at 06:51:09AM +0100, Jamie Brandon wrote: > I was hoping to have my summer of code blog added to planet haskell > but [EMAIL PROTECTED] no longer seems to exist. Hopefully > the owner is subscribed to this list? It exists but seems to be broken. Thank you for letting me know.

Re: [Haskell-cafe] number-parameterized types and heterogeneous lists

2008-06-23 Thread Luke Palmer
On Mon, Jun 23, 2008 at 6:50 AM, Harald ROTTER <[EMAIL PROTECTED]> wrote: > Hello, > > sorry for the late answer, I was off for the weekend :-) > > The paper "Number-parameterized types" by Oleg Kielyov is located at > > http://okmij.org/ftp/papers/number-parameterized-types.pdf > > It impress

Re: [Haskell-cafe] Help with generalizing function

2008-06-23 Thread leledumbo
>> tuples may contain any combination of types, use lists instead I think so, too. >> You can use <- in a list comprehension or list "do"-block to select a >> single list from a list of lists. Is it related with my question? I mean, instead of extracting, I need to construct lists. -- View this