Re: [Haskell-cafe] Google Android

2008-09-25 Thread Adam Langley
e Haskell to Java, Java bytecode or DEX directly. A Google search for "haskell java" turns up at least one good candidate[1], but if you manage to get that working well, binding the APIs is a rather trivial task ;) [1] http://www.cse.unsw.edu.au/~pls/thesis-topics/ghcjava.html A

Re: [Haskell-cafe] Re: Iteratee-based IO

2008-09-21 Thread Adam Langley
tionally) IE_Fail, for indicating a parse failure. The actual implementation is unpleasant, although functional. [1] http://darcs.imperialviolet.org/darcsweb.cgi?r=binary-strict;a=headblob;f=/src/Data/Binary/Strict/IncrementalGet.hs -- Adam Langley [EMAIL PROTECTED] http://www.i

Re: [Haskell-cafe] control-timeout with gtk

2008-09-18 Thread Adam Langley
the time to deal with. It's a constant cost for my name to be associated with them and, if nobody cares enough to take the maintainership, they should probably die - Hackage has a lot of packages these days. Do you want control-timeout? :) AGL -- Adam Langley [EMAIL PROTECTED] ht

Re: [Haskell-cafe] control-timeout with gtk

2008-09-18 Thread Adam Langley
-minihttp network-rpca system-inotify Cheers -- Adam Langley [EMAIL PROTECTED] http://www.imperialviolet.org ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Libevent FFI problems

2008-07-28 Thread Adam Langley
d be better for you(, and for everyone else!) than avoiding the use of GHC threads. But, with that error, you're correct that the current select based system is insufficient. AGL -- Adam Langley [EMAIL PROTECTED] http://www.imperialviolet.org ___ Ha

Re: [Haskell-cafe] Libevent FFI problems

2008-07-25 Thread Adam Langley
hink it's safe to assume that no one has taken it up yet. Personally, some of my other projects are higher priorities at the moment. I'd suggest that you write your server on the select() based system as-is for now. Then, when you need epoll you'll be sufficiently motivated to ha

Re: [Haskell-cafe] Libevent FFI problems

2008-07-25 Thread Adam Langley
ic. That's a good reference. Also note that the paper is 6 years old and GHC has come a long way since then. I'd suspect that the graph on page 15 would look much more favourable to Haskell these days. AGL -- Adam Langley [EMAIL PROTECTED] http://www.imperialviolet.org _

Re: [Haskell-cafe] Libevent FFI problems

2008-07-25 Thread Adam Langley
ific problem, I see you're allocating xptr, but I don't see that you're ever poking a value into it. Indeed, I can't see that createEvent ever uses 'x'. Hope that helps. AGL -- Adam Langley [EMAIL PROTECTED] http://www.imperialviolet.org ___

Re: [Haskell-cafe] Haskell, Microsoft, and interview questions

2008-06-26 Thread Adam Langley
ny > recommendations? Specialised for 2d only, but: http://www.imperialviolet.org/binary/NearestNeighbour2D.hs AGL -- Adam Langley [EMAIL PROTECTED] http://www.imperialviolet.org ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haske

Re: [Haskell-cafe] safe vs unsafe

2008-06-24 Thread Adam Langley
On Tue, Jun 24, 2008 at 12:08 PM, Galchin, Vasili <[EMAIL PROTECTED]> wrote: > yes I am invoking a callback function written in Haskell. Then you should just need to remove the "unsafe" from the foreign import decl which leads to the callback getting called. AGL --

Re: [Haskell-cafe] safe vs unsafe

2008-06-24 Thread Adam Langley
uently, objects other than stable pointers (cf. Section 5.6) may be moved or garbage collected by the storage manager." -- Adam Langley [EMAIL PROTECTED] http://www.imperialviolet.org ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

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

2008-06-23 Thread Adam Langley
s) easier. AGL -- Adam Langley [EMAIL PROTECTED] http://www.imperialviolet.org ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

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

2008-06-23 Thread Adam Langley
g/hoogle/hoodoc.cgi?module=Foreign.Marshal.Alloc&name=mallocBytes&mode=func [2] http://www.haskell.org/hoogle/hoodoc.cgi?module=Foreign.ForeignPtr&name=newForeignPtr&mode=func [3] http://www.haskell.org/hoogle/hoodoc.cgi?module=Foreign.ForeignPtr&name=withForeignPtr&mode=func -- Adam Langl

Re: [Haskell-cafe] IMAP and NNTP libraries

2008-06-23 Thread Adam Langley
the answer is "no" I'm afraid. Perhaps you would care to write such libraries if you have a need? [1] http://hackage.haskell.org/packages/archive/pkg-list.html -- Adam Langley [EMAIL PROTECTED] http://www.imperialviolet.org ___ Haskel

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

2008-06-23 Thread Adam Langley
ce an AIO interface is probably going to return while the IO is still in progress, you don't want to stop the collector, but nor do you want the data moving because the kernel's pointer isn't going to move with it. AGL -- Adam Langley [EMAIL PROTECTED] http://www.imperialviolet.org

Re: [Haskell-cafe] Re: Bit Streams

2008-06-19 Thread Adam Langley
tp). You're right that I should add Applicative too; maybe this weekend. AGL -- Adam Langley [EMAIL PROTECTED] http://www.imperialviolet.org ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Re: Bit Streams

2008-06-19 Thread Adam Langley
f I took his highly tuned binary library and made it slow :) AGL -- Adam Langley [EMAIL PROTECTED] http://www.imperialviolet.org ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Re: Bit Streams

2008-06-18 Thread Adam Langley
le of binary-strict is better. AGL -- Adam Langley [EMAIL PROTECTED] http://www.imperialviolet.org ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] blas bindings, why are they so much slower the C?

2008-06-18 Thread Adam Langley
On Wed, Jun 18, 2008 at 9:16 AM, Anatoly Yakovenko <[EMAIL PROTECTED]> wrote: > C doesn't work like that :) Yes it can. You would have to check the disassembly to be sure, but C compilers can, and do, perform dead code elimination. AGL -- Adam Langley [EMAIL P

Re: [Haskell-cafe] Re: Bit Streams

2008-06-18 Thread Adam Langley
alviolet.org/darcsweb.cgi?r=binary-strict;a=headblob;f=/src/Data/Binary/BitPut.hs -- Adam Langley [EMAIL PROTECTED] http://www.imperialviolet.org ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] who maintains the POSIX/Unix Unistd.hs?

2008-05-07 Thread Adam Langley
like it's exported from anywhere, just used internally for c_nanosleep AGL -- Adam Langley [EMAIL PROTECTED] http://www.imperialviolet.org ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Re: RFC: A standardized interface between web servers and applications or frameworks (ala WSGI)

2008-04-14 Thread Adam Langley
that an application which only cares about 2616 headers can do call a single function to parse them all, but I no longer advocate that the base interface use parsed forms of headers. Also, parsing URLs seems to be pretty uncontroversial (maybe parsing key, value pairs from the path, maybe no

[Haskell-cafe] Re: RFC: A standardized interface between web servers and applications or frameworks (ala WSGI)

2008-04-13 Thread Adam Langley
ttle for a non static: checkUnparsedHeaders :: [String] -> IO () Which can be put in 'main' (or equivalent) and can call error if there's a mismatch. AGL -- Adam Langley [EMAIL PROTECTED] http://www.imperialviolet.org ___ Haskell-

[Haskell-cafe] Re: RFC: A standardized interface between web servers and applications or frameworks (ala WSGI)

2008-04-13 Thread Adam Langley
tp;a=headblob;f=/Network/MiniHTTP/URL.hs AGL -- Adam Langley [EMAIL PROTECTED] http://www.imperialviolet.org ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] ghc

2008-04-10 Thread Adam Langley
libs. One thing that you might need on the target host is GMP, however that's pretty common. AGL -- Adam Langley [EMAIL PROTECTED] http://www.imperialviolet.org ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] [GSoC] Student applications deadline extended one week

2008-03-31 Thread Adam Langley
n Python. AGL -- Adam Langley [EMAIL PROTECTED] http://www.imperialviolet.org ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] [GSoC] X Haskell bindings

2008-03-31 Thread Adam Langley
al subset of the functions (the last two need not be in Haskell, although I suspect that it would be a good idea for them to be so) * The first, minimal, Haskell X client using XCB * Having sensible bindings for 25%/50%/75% and 100% of the XCB interface. AGL -- Adam Langley [EMAIL PRO

Re: [Haskell-cafe] Re: HTTP client libraries

2008-03-29 Thread Adam Langley
edirects would be a good start but, other than that, I'm rather distracted with elliptic curve groups at the moment. AGL -- Adam Langley [EMAIL PROTECTED] http://www.imperialviolet.org ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www

Re: [Haskell-cafe] HTTP client libraries

2008-03-27 Thread Adam Langley
The client doesn't do a lot, but I don't know what you would want from a client. Email me a list of use cases and ;) It does support HTTPS, however. See examples/webcat.hs AGL -- Adam Langley [EMAIL PROTECTED] http://www.imperialviolet.org __

Re: [Haskell-cafe] AMQP framing layer: design help requested.

2008-03-21 Thread Adam Langley
On Fri, Mar 21, 2008 at 6:41 PM, Adam Langley <[EMAIL PROTECTED]> wrote: > Firstly, I would use the Get and Put monads directly, rather than > making them instances of Binary. Also, while I'm at it - I believe that AMQP messages and small and delineated. I

Re: [Haskell-cafe] AMQP framing layer: design help requested.

2008-03-21 Thread Adam Langley
p (amqpGetTable !) getWord8 Hope that helps some AGL -- Adam Langley [EMAIL PROTECTED] http://www.imperialviolet.org ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] ANN: Network.MiniHTTP 0.2

2008-03-20 Thread Adam Langley
ve timeouts for talking to the network. However, these shouldn't be too hard. [1] http://hackage.haskell.org/cgi-bin/hackage-scripts/package/network-minihttp-0.2 -- Adam Langley [EMAIL PROTECTED] http://www.imperialviolet.org ___ Haskell-Cafe maili

Re: [Haskell-cafe] Satnam Singh of Microsoft Research

2008-03-18 Thread Adam Langley
s given a talk at Google. (It might have been very informal, in which case there wouldn't be a record of it, and nor would there be a video) Cheers, AGL -- Adam Langley [EMAIL PROTECTED] http://www.imperialviolet.org ___ Haskell-Cafe mailing list Ha

Re: [Haskell-cafe] Re: all threads are blocked by recvFrom

2008-03-18 Thread Adam Langley
peeps like to speak up here? AGL -- Adam Langley [EMAIL PROTECTED] http://www.imperialviolet.org ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Re: all threads are blocked by recvFrom

2008-03-17 Thread Adam Langley
L, O_RDWR|O_NONBLOCK) = 0 You can see that the socket is set to non-blocking immediately. [1] http://haskell.org/ghc/docs/latest/html/libraries/network/src/Network-Socket.html#recvFrom -- Adam Langley [EMAIL PROTECTED] http://www.imperialviolet.org __

Re: [Haskell-cafe] GHC threaded RTS will call the finaliser of a ForeignPtr while references still exist

2008-03-16 Thread Adam Langley
/ghc/ticket/2161 AGL -- Adam Langley [EMAIL PROTECTED] http://www.imperialviolet.org ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Re: GHC threaded RTS will call the finaliser of a ForeignPtr while references still exist

2008-03-16 Thread Adam Langley
On Sun, Mar 16, 2008 at 8:40 PM, Adam Langley <[EMAIL PROTECTED]> wrote: > I believe that I've managed to distill a crash which has been driving > me crazy for a few days into a short enough test case (22 lines) that > it might be useful. Cale made a suggestion which shor

[Haskell-cafe] GHC threaded RTS will call the finaliser of a ForeignPtr while references still exist

2008-03-16 Thread Adam Langley
oping that this is useful to someone who knows the RTS. Cheers, -- Adam Langley [EMAIL PROTECTED] http://www.imperialviolet.org ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Re: all threads are blocked by recvFrom

2008-03-14 Thread Adam Langley
On Fri, Mar 14, 2008 at 10:13 AM, Adam Langley <[EMAIL PROTECTED]> wrote: > See [1] for an example which works for me. (If you're on Windows, you probably need to wrap main in withSocketsDo) AGL -- Adam Langley [EMAIL PROTECTED] http://www.impe

Re: [Haskell-cafe] Re: all threads are blocked by recvFrom

2008-03-14 Thread Adam Langley
get this: "working..." "working..." ("testing\n",8,127.0.0.1:36179) "working..." "working..." ("testing two\n",12,127.0.0.1:36179) "working..." [1] http://hpaste.org/6362 -- Adam Langley [EMAIL PROTECTED] http://www.impe

Re: [Haskell-cafe] Re: all threads are blocked by recvFrom

2008-03-14 Thread Adam Langley
the code for send and recv in there. Alternatively, you can use the functions in Network.Socket, which should work fine. [1] http://haskell.org/ghc/docs/latest/html/libraries/base/Control-Concurrent.html#v%3AthreadWaitRead [2] http://hackage.haskell.org/cgi-bin/hackage-scripts/package/network-b

Re: [Haskell-cafe] Problem making a program in ghc

2008-03-13 Thread Adam Langley
ng Handles to interface to the network, they can buffer the response. hFlush[1] may need to be called when you have finished generating it. [1] http://haskell.org/ghc/docs/latest/html/libraries/base/System-IO.html#v%3AhFlush AGL -- Adam Langley [EMAIL PR

Re: [Haskell-cafe] Starting Haskell with a web application

2008-03-12 Thread Adam Langley
On Wed, Mar 12, 2008 at 3:49 PM, Adam Langley <[EMAIL PROTECTED]> wrote: > The OpenID example is running in EC2[4] at the moment if anyone wants to > play. Well, thanks to all the people who hit it, there's nothing like users to find the stupid bugs ;) * Caching was wrong

Re: [Haskell-cafe] Starting Haskell with a web application

2008-03-12 Thread Adam Langley
On Wed, Mar 5, 2008 at 12:25 PM, Adam Langley <[EMAIL PROTECTED]> wrote: > I'm > working towards, is an OpenID consumer. Once I have that working, I'll > do a second release. It's not that far off, it's just a question of > time. The darcs release of m

Re: [Haskell-cafe] Re: Constructing Data.Map from ByteString

2008-03-12 Thread Adam Langley
e overflow :( Map is probably a better choice than HashMap. Exactly how large is the input? Like I said, I got about 2x bloat (measured by RSS), maybe you can send a fuller example code? AGL -- Adam Langley [EMAIL PROTECTED] http://www.imperialviolet.org __

Re: [Haskell-cafe] Constructing Data.Map from ByteString

2008-03-12 Thread Adam Langley
e to try and figure out which module they are going to resolve into all the time! Cheers, AGL -- Adam Langley [EMAIL PROTECTED] http://www.imperialviolet.org ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] STM example code

2008-03-09 Thread Adam Langley
j/papers/stm/index.htm -- Adam Langley [EMAIL PROTECTED] http://www.imperialviolet.org ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Re: Difficulties implementing an incremental parser using Oleg-style left fold enumerator

2008-03-08 Thread Adam Langley
normal processing, such a state doesn't arise. Otherwise, have a Maybe in your state and set it to Nothing when the input is exhausted. Then have combinators, like many, handle the EOF case sensibly. AGL -- Adam Langley [EMAIL PROTECTED] http://www.imperialviolet.org

Re: [Haskell-cafe] Re: Network.Socket Woes

2008-03-07 Thread Adam Langley
ere was the trick that I've been missing all this time ;) I'll probably submit a documentation patch for this since I'm a Bear of Little Brain and this wasn't obvious to me. -- Adam Langley [EMAIL PROTECTED] http://www.imperialviolet.org ___

Re: [Haskell-cafe] Network.Socket Woes

2008-03-07 Thread Adam Langley
askell I'm afraid. I usually end up FFIing out to htons or just assuming that the system is little-endian. We should really fix this unless there's some trick that I've been missing all this time. AGL -- Adam Langley [EMAIL PROTECTED] http://www.imperialviolet.org __

Re: [Haskell-cafe] Starting Haskell with a web application

2008-03-06 Thread Adam Langley
e filesystem quite happily. The darcs repo is just a mess at the moment. (darcs.imperialviolet.org/network-minihttp) [1] http://hackage.haskell.org/cgi-bin/hackage-scripts/package/network-minihttp-0.1 AGL -- Adam Langley [EMAIL PROTECTED] http://www.imperi

Re: [Haskell-cafe] Starting Haskell with a web application

2008-03-05 Thread Adam Langley
On Wed, Mar 5, 2008 at 11:07 AM, Bryan O'Sullivan <[EMAIL PROTECTED]> wrote: > Indeed. In addition to the code you mention, people like Adam Langley > and Johan Tibbell are taking on corners of the web app problem space in > a more modern context. I should probably s

Re: [Haskell-cafe] Connection helpers: for people interested in network code

2008-03-04 Thread Adam Langley
. However, it shouldn't be too hard to wrap HsOpenSSL in this interface. I might try this this week. Then HTTPS should Just Work (maybe ;) AGL -- Adam Langley [EMAIL PROTECTED] http://www.imperialviolet.org ___ Haskell-Cafe mailing li

Re: [Haskell-cafe] .cabal problem

2008-03-01 Thread Adam Langley
re running. If it's < 6.8, you may have problems because the directory package didn't exist before then, I believe the same modules were in the base package. In that case, the easy solution is probably to upgrade GHC. [1] http://hackage.haskell.org/cgi-bin/hackage-scripts/package/dir

[Haskell-cafe] Connection helpers: for people interested in network code

2008-02-29 Thread Adam Langley
wanted to avoid hitting the monomorphism restriction in code. That might have been a mistake, I'm not sure yet. If it doesn't excite anyone enough to reply, I'll change the name and put it in Hackage, mostly as is. Then I'll tie HsOpenSSL into it so that SSL connections work tran

Re: [Haskell-cafe] parsing c

2008-02-24 Thread Adam Langley
On Sun, Feb 24, 2008 at 4:08 PM, Evan Martin <[EMAIL PROTECTED]> wrote: > So two questions: Is there an alternative C-parsing library? You could use gcc-xml[1] with one of the various XML parsers. [1] http://www.gccxml.org/HTML/Index.html -- Adam Langley [EMAIL PROTEC

Re: [Haskell-cafe] A beginners question

2008-02-23 Thread Adam Langley
d [] right now, but it will apply 'shows i " "' to each element in the first list and concat the results. Since strings are just [Char], concating them is string concatenation. And so you have "1 16 81 " (again, note the trailing space) AGL -- Adam Langley [EMAIL P

[Haskell-cafe] ANN: ctemplate, SSL server support in HsOpenSSL, network-minihttp, binary parsing, network-dns

2008-02-14 Thread Adam Langley
o serious with it yet, however. It needs a few limits to stop DoS attackers from, for example, sending an infinite header and using up all the memory :) [4] http://hackage.haskell.org/packages/archive/network-dns/0.1.1/doc/html/Network-DNS-Client.html -- Adam Langley [EMAIL PROTECTED] http://www.i

Re: [Haskell-cafe] getSymbolicLinkStatus completely broken on some 6.8.2 systems

2008-02-14 Thread Adam Langley
Filed as: http://hackage.haskell.org/trac/ghc/ticket/2096 -- Adam Langley [EMAIL PROTECTED] http://www.imperialviolet.org 650-283-9641 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] getSymbolicLinkStatus completely broken on some 6.8.2 systems

2008-02-12 Thread Adam Langley
On Feb 12, 2008 11:04 PM, Adam Langley <[EMAIL PROTECTED]> wrote: > structure filled in. HsUnix.h has a wrapper around lstat for exactly > this reason, however ltrace shows it calling the wrong one. So (finally!) the real issue: hsc2hs has a C preprocessor prelude (utils/hsc2hs/te

Re: [Haskell-cafe] getSymbolicLinkStatus completely broken on some 6.8.2 systems

2008-02-12 Thread Adam Langley
On Feb 12, 2008 10:44 PM, Adam Langley <[EMAIL PROTECTED]> wrote: > Currently I'm looking at hsc2hs for this bug. On a 32 bit box here: hsc2hs is forgiven; if you build with #define _FILE_OFFSET_BITS 32 then the structure is 96 bytes and the 64-bit offset is, indeed, at offset 88

Re: [Haskell-cafe] getSymbolicLinkStatus completely broken on some 6.8.2 systems

2008-02-12 Thread Adam Langley
function (which does both the lstat and extraction from the structure) and FFI it. AGL -- Adam Langley [EMAIL PROTECTED] http://www.imperialviolet.org 650-283-9641 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] example packages that use Storable in Hackage ??

2008-02-11 Thread Adam Langley
2008/2/11 Galchin Vasili <[EMAIL PROTECTED]>: > http://hackage.haskell.org/packages/archive/pkg-list.html .. what are > some packages that use Storable? binary and binary-strict at least. AGL -- Adam Langley [EMAIL PRO

Re: [Haskell-cafe] ANN: nano-hmac 0.2.0

2008-02-11 Thread Adam Langley
n nice bindings to much of OpenSSL: http://hackage.haskell.org/cgi-bin/hackage-scripts/package/HsOpenSSL-0.3.1 AGL -- Adam Langley [EMAIL PROTECTED] http://www.imperialviolet.org 650-283-9641 _

Re: [Haskell-cafe] question concerning ANSI "void *"

2008-02-08 Thread Adam Langley
), you'll need to marshal yourself: data SomeIOCtlStruct = CInt CInt CInt ioctlSomeIOCtlStruct :: CInt -> CInt -> SomeIOCtlStruct -> IO () ioctlSomeIOCtlStruct = do ... (see the above linked to pointers to hsc2hs and c2hs about how to write this function) AG

Re: [Haskell-cafe] question concerning ANSI "void *"

2008-02-08 Thread Adam Langley
erning.org/magnus/archives/tag/hsc2hs [2] http://www.cse.unsw.edu.au/~chak/haskell/c2hs/ -- Adam Langley [EMAIL PROTECTED] http://www.imperialviolet.org 650-283-9641 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] question concerning ANSI "void *"

2008-02-07 Thread Adam Langley
e or a Bits type. Having a Ptr Baz where Baz is an ADT seems a little odd. If you need to translate a structure from Haskell to C code, probably you are better off having callers pass in a Baz then, internal to the wrapping, fill out the C structure and call the FFI function with a Ptr CBaz (wher

Re: [Haskell-cafe] reading from the cdrom drive on Red Hat

2008-02-01 Thread Adam Langley
1) My bad, I thought that the Posix.IO stuff was a closer wrapping than that. It does, indeed, throw an exception on 0. How unfortunate. AGL -- Adam Langley [EMAIL PROTECTED] http://www.imperialviolet.org

Re: [Haskell-cafe] reading from the cdrom drive on Red Hat

2008-02-01 Thread Adam Langley
tualByteCount == 0. You can catch and handle the resulting exception with the functions in: http://haskell.org/ghc/docs/latest/html/libraries/base/Control-Exception.html AGL -- Adam Langley [EMAIL PROTECTED] http://www.imperialviolet.org

Re: [Haskell-cafe] Simple network client

2008-01-31 Thread Adam Langley
re thinking of layering a unionfs over the top. It works well in my experience. AGL -- Adam Langley [EMAIL PROTECTED] http://www.imperialviolet.org 650-283-9641 ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] Simple network client

2008-01-30 Thread Adam Langley
On Jan 30, 2008 1:07 PM, Adam Langley <[EMAIL PROTECTED]> wrote: > So, if I don't hear otherwise soon, I'll probably push a new version > of binary-strict later on today with the interface above. It's in the darcs now, http://darcs.imperialviolet.org/binary-str

Re: [Haskell-cafe] Simple network client

2008-01-30 Thread Adam Langley
On Jan 30, 2008 12:04 PM, Bryan O'Sullivan <[EMAIL PROTECTED]> wrote: > Adam Langley wrote: > I'd have expected it to look more like this: > > data Result a = Failed String > | Finished B.ByteString a > | Partial (B.ByteString -> Res

Re: [Haskell-cafe] ffi and pass by value structs

2008-01-30 Thread Adam Langley
ls the real function with the contents of that pointer. Then you just call your wrapper function. You can make these functions by the dozen with the preprocessor. AGL -- Adam Langley [EMAIL PROTECTED] http

Re: [Haskell-cafe] Simple network client

2008-01-30 Thread Adam Langley
e IncrementalGet in the binary-strict package which is a Get with a continuation monad that stops when it runs out of bytes and returns a continuation that you can give more data to in the future. AGL -- Adam Langley [EMAIL PROTECTED] http://www.im

Re: [Haskell-cafe] Performance Issues

2008-01-29 Thread Adam Langley
tp://haskell.org/ghc/docs/latest/html/libraries/base/src/GHC-List.html#foldr1 AGL -- Adam Langley [EMAIL PROTECTED] http://www.imperialviolet.org 650-283-9641 ___ Haskell-Cafe maili

Re: [Haskell-cafe] Simple network client

2008-01-29 Thread Adam Langley
nning strace twice, with different binaries and output files) and send me the resulting traces? (They'll be quite big, so I don't know if you want to spam that whole list with them) Cheers AGL -- Adam Langley [EMAIL PROTECTED] http://www.imperialvi

[Haskell-cafe] ANN: RPCA and fec

2008-01-27 Thread Adam Langley
of only a single element, it can be parameterized to choose in advance the number of elements whose loss it can tolerate. Hackage: http://hackage.haskell.org/packages/archive/fec/0.1.1/doc/html/Codec-FEC.html It's new code, but the library that it's

Re: [Haskell-cafe] Upgrading ByteString causes (seemingly) impossible RTS linker errs

2008-01-27 Thread Adam Langley
update bytestring...) Cheers, -- Adam Langley [EMAIL PROTECTED] http://www.imperialviolet.org 650-283-9641 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman

Re: [Haskell-cafe] CPP and INLINE pragmas

2008-01-20 Thread Adam Langley
Thanks Isaac and Malcolm. That neatly solves all my problems! AGL -- Adam Langley [EMAIL PROTECTED] http://www.imperialviolet.org 650-283-9641 ___ Haskell-Cafe mailing list Haskell-Cafe

Re: [Haskell-cafe] Re: ANN: A triple of new packages for talking tothe outside world

2008-01-20 Thread Adam Langley
On Jan 15, 2008 7:33 PM, Adam Langley <[EMAIL PROTECTED]> wrote: > Ok, no TH ;) I've just uploaded binary-strict 0.2.2 to Hackage which factors most of the common code out via CPP. Hopefully I didn't break anything. AGL -- Adam Langley

[Haskell-cafe] CPP and INLINE pragmas

2008-01-20 Thread Adam Langley
LINE needs to start at the beginning of a line. Has anyone a workaround for this, or a way to get the preprocessor to output a newline? Cheers AGL -- Adam Langley [EMAIL PROTECTED] http://www.imperialviolet.org 65

Re: [Haskell-cafe] bytea decoding

2008-01-20 Thread Adam Langley
ByteString byteaDecode = B.pack . catMaybes . snd . mapAccumL f initState . B.unpack where initState = (0, 0) f (0, _) 92 = ((1, 0), Nothing) f (0, _) x = ((0, 0), Just x) f (1, _) 92 = ((0, 0), Just 92) f (3, n) x = ((0, 0), Just (n * 8 + (x - 48))) f (c, n) x = ((c + 1, n * 8 + (x -

Re: [Haskell-cafe] Re: ANN: A triple of new packages for talking tothe outside world

2008-01-17 Thread Adam Langley
hould return a spine of 1 byte strict ByteStrings.) A fully lazy BitGet would also be possible, of course, I've just not written it yet ;) > Adam Langley imperialviolet.org> writes: > Another thought: could e.g. getRightByteString be in the IO monad and then I > don't have

Re: [Haskell-cafe] Re: ANN: A triple of new packages for talking tothe outside world

2008-01-16 Thread Adam Langley
the next $n$ bits in a ByteString of Word8's. The padding is either at the end of the last byte (left aligned) or at the beginning of the first byte (right aligned). If you did want a [Bool], you could use: bits <- sequence $ take n $ repeat getBit AGL -- Adam Langley

Re: [Haskell-cafe] Re: ANN: A triple of new packages for talking tothe outside world

2008-01-15 Thread Adam Langley
On Jan 15, 2008 5:01 PM, Neil Mitchell <[EMAIL PROTECTED]> wrote: > That would be bad. Then you'll have gone from Data.Binary being > portable code, to being GHC specific code, and I will cry :'-( Ok, no TH ;) AGL -- Adam Langley

Re: [Haskell-cafe] Re: ANN: A triple of new packages for talking tothe outside world

2008-01-15 Thread Adam Langley
thin binary-strict and between binary and binary-strict. I think this code needs a whole lot of restructuring (maybe a bit of TH for generating the common bits). I'll get to that when it appears that the API seems reasonable. AGL -- Adam Langley

Re: [Haskell-cafe] Re: ANN: A triple of new packages for talking tothe outside world

2008-01-15 Thread Adam Langley
fully I'm just doing something stupid). [1] http://hackage.haskell.org/cgi-bin/hackage-scripts/package/binary-strict-0.2.1 AGL -- Adam Langley [EMAIL PROTECTED] http://www.imperialviolet.org 650-283-9641 ___

Re: [Haskell-cafe] Re: ANN: A triple of new packages for talking tothe outside world

2008-01-09 Thread Adam Langley
at least. How about a BitGet monad which get be run in the Get monad? > test :: Get () > test = do > runBitGet 2 (do >getBitField 2) So the first argument to runBitGet is the number of bytes to parse for bit fields and then functions in BitGet can extract bit-len

Re: [Haskell-cafe] Data.Binary and serialising doubles in IEEE format

2008-01-09 Thread Adam Langley
hen 0x80 else 0)) sign = if n `shiftR` 31 == 0 then 1 else -1 exp = rawExp - (127 + 23) rawExp = (n `shiftR` 23) .&. 0xff (b, rest) = BS.splitAt 4 bytes n :: Word32 n = foldl1 (.|.) $ map (\(s, v) -> (fromIntegral v) `shiftL` s) $ zip [0, 8, 16, 24] $ BS.unpack b AGL

Re: [Haskell-cafe] ANN: A triple of new packages for talking to the outside world

2008-01-08 Thread Adam Langley
to tell that Partial apart from one which has "real" values. But if this is useful to you, make any requests. I'll (hopefully) do them, clean it up and push a new release of binary-strict. AGL -- Adam Langley [EMAIL PROTECTED] http://www.imperialvi

Re: [Haskell-cafe] ANN: A triple of new packages for talking to the outside world

2008-01-07 Thread Adam Langley
It wouldn't be too hard to make up something like that using ContT if it would be useful to you. AGL -- Adam Langley [EMAIL PROTECTED] http://www.imperialviolet.org 650-283-9641 ___

[Haskell-cafe] ANN: A triple of new packages for talking to the outside world

2008-01-06 Thread Adam Langley
eouts - e.g. actions which occur after a given number of seconds and which can be canceled. It does it in a not-totally-stupid fashion so that you don't need to worry about setting hundreds of them. AGL -- Adam Langley [EMAIL PROTECTED] http

[Haskell-cafe] Getting links to Haddock documentation in Hackage

2007-12-29 Thread Adam Langley
't (always) get the magic links. Cheers, AGL [1] http://hackage.haskell.org/cgi-bin/hackage-scripts/package/bzlib-0.4.0.1 [2] http://hackage.haskell.org/packages/archive/bzlib/0.4.0.1/doc/html/Codec-Compression-BZip.html [3] http://hackage.haskell.org/cgi-bin/hackage-scripts/package/tar-0

Re: [Haskell-cafe] very elementary "import" problem .. help

2007-11-23 Thread Adam Langley
't be surprised if System.Posix just doesn't exist for Windows. System.Process is marked as portable, so I'm not sure why that one wouldn't be found. Finally, I believe that you want Control.Concurrent.STM. AGL -- Adam Langley [EMAIL PROTECTED]

Re: [Haskell-cafe] Distributed haskell using Hadoop

2007-10-16 Thread Adam Langley
GHC API for code motion and building a simple MapReduce like framework etc. -- Adam Langley [EMAIL PROTECTED] http://www.imperialviolet.org 650-283-9641 ___ Haskell-Cafe mailing list Haskell-Ca

Re: [Haskell-cafe] ANNOUNCE: binary 0.4: high performance, pure binary parsing and serialisation

2007-10-06 Thread Adam Langley
be a parallel quicktest - which is cool because the tests took quite a while previously). -- Adam Langley [EMAIL PROTECTED] http://www.imperialviolet.org 650-283-9641 ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] GHC optimisations

2007-08-23 Thread Adam Langley
get this affect, but I'm not sure you can be sure that you don't ever get it. Floating point numbers make me sad :( AGL -- Adam Langley [EMAIL PROTECTED] http://www.imperialviolet.org 650-283-9641 _

Re: [Haskell-cafe] Parsing binary data.

2007-08-20 Thread Adam Langley
). If these functions would be useful for you, you should bug the binary team to add something similar. AGL -- Adam Langley [EMAIL PROTECTED] http://www.imperialviolet.org 650-283-9641 data-binary-float.da

Re: [Haskell-cafe] Parsing binary data.

2007-08-19 Thread Adam Langley
speed, and an alternative which returns a Maybe, removing a little bit of lazyness in cases where you want to handle parse failures in pure code. Hopefully something will happen with this at the next sprint ;) ) [1] http://www.cse.unsw.edu.au/~dons/binary/Data-Binary.html#1 -- Adam L

Re: [Haskell-cafe] Parsing binary data.

2007-08-18 Thread Adam Langley
aught as exceptions when you actually come to using the result. This is perfect for very large messages, but might be slightly wrong for you. [1] http://hackage.haskell.org/cgi-bin/hackage-scripts/package/binary-0.3 -- Adam Langley [EMAIL PROTECTED] h

  1   2   >