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

2008-06-21 Thread Galchin, Vasili
Hello, I want to model an I/O read/write buffer in Haskell and marshall down into ANSI C. 1) ByteString? Or Ptr Word8? 2) What are example values of the types in 1)? Kind regards, Vasili ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http

[Haskell-cafe] IMAP and NNTP libraries

2008-06-21 Thread Maurí­cio
Hi, Are there mature libraries for IMAP and NNTP available to Haskell? Thanks, Maurício ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] message passing style like in Haskell?

2008-06-21 Thread jinjing
After some fiddling with this style, here is what I came up with for the 8 queens problem in the 99 problem set. It's quite entertaining ... ( note: it's brute force and requires a combination library ) queens2 n = n.permutations.filter all_satisfied where all_satisfied queens = queens.diff_col

Re: [Haskell-cafe] Pretty little definitions of left and right folds

2008-06-21 Thread Derek Elkins
On Sat, 2008-06-21 at 22:48 -0400, Brent Yorgey wrote: > On Sat, Jun 21, 2008 at 09:36:06PM -0500, Derek Elkins wrote: > > On Sat, 2008-06-21 at 21:11 -0400, Brent Yorgey wrote: > > > On Fri, Jun 20, 2008 at 09:52:36PM -0500, Derek Elkins wrote: > > > > On Fri, 2008-06-20 at 22:31 -0400, Brent Yorg

Re: [Haskell-cafe] Pretty little definitions of left and right folds

2008-06-21 Thread Brent Yorgey
On Sat, Jun 21, 2008 at 09:36:06PM -0500, Derek Elkins wrote: > On Sat, 2008-06-21 at 21:11 -0400, Brent Yorgey wrote: > > On Fri, Jun 20, 2008 at 09:52:36PM -0500, Derek Elkins wrote: > > > On Fri, 2008-06-20 at 22:31 -0400, Brent Yorgey wrote: > > > > On Fri, Jun 20, 2008 at 06:15:20PM -0500, Geo

Re: [Haskell-cafe] Pretty little definitions of left and right folds

2008-06-21 Thread Derek Elkins
On Sat, 2008-06-21 at 21:11 -0400, Brent Yorgey wrote: > On Fri, Jun 20, 2008 at 09:52:36PM -0500, Derek Elkins wrote: > > On Fri, 2008-06-20 at 22:31 -0400, Brent Yorgey wrote: > > > On Fri, Jun 20, 2008 at 06:15:20PM -0500, George Kangas wrote: > > > > > > > > foldright (+) [1, 2, 3] 0 == ( (1 +

Re: [Haskell-cafe] Pretty little definitions of left and right folds

2008-06-21 Thread Luke Palmer
On Sat, Jun 21, 2008 at 7:11 PM, Brent Yorgey <[EMAIL PROTECTED]> wrote: > First, given finite sets A (representing an 'alphabet') and S > (representing 'states'), we can describe a finite state machine by a > function phi : A x S -> S, which gives 'transition rules' giving a new > state for each c

Re: [Haskell-cafe] Pretty little definitions of left and right folds

2008-06-21 Thread Brent Yorgey
On Fri, Jun 20, 2008 at 09:52:36PM -0500, Derek Elkins wrote: > On Fri, 2008-06-20 at 22:31 -0400, Brent Yorgey wrote: > > On Fri, Jun 20, 2008 at 06:15:20PM -0500, George Kangas wrote: > > > > > > foldright (+) [1, 2, 3] 0 == ( (1 +).(2 +).(3 +).id ) 0 > > > foldleft (+) [1, 2, 3] 0 == ( id.(3 +)

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

2008-06-21 Thread Dan Doel
On Saturday 21 June 2008, Don Stewart wrote: > maybeRead :: Read a => String -> Maybe a > maybeRead s = case reads s of > [(x, "")] -> Just x > _ -> Nothing Note, if you want to match the behavior of read, you'll probably want something like: maybeRead

Re: [Haskell-cafe] Access to Oracle database from Haskell

2008-06-21 Thread Lanny Ripple
Lanny Ripple wrote: > I had luck with this the other day using Database.HDBC.ODBC. For > Ubuntu's Hardy I found that Oracle's 10.2.0.3 worked best. > (10.2.0.4 and 11 seemed to have problems for me at least.) > > http://www.oracle.com/technology/software/tech/oci/instantclient/htdocs/linuxsoft.ht

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

2008-06-21 Thread Xiao-Yong Jin
Don Stewart <[EMAIL PROTECTED]> writes: > The main thing is to define a safe read. This will be in the base > library soon, > > maybeRead :: Read a => String -> Maybe a > maybeRead s = case reads s of > [(x, "")] -> Just x > _ -> Nothing > > Then you can pat

[Haskell-cafe] Re: ANNOUNCE: Pipe 1.0

2008-06-21 Thread Matti Niemenmaa
Don Stewart wrote: Interesting. Does it depend on an unreleased version of the process library? Indeed it does. Actually most of the code was written using the current released version, I just jumped the gun a bit when I saw how nice the new interface was. I'm hoping that the release of the

Re: [Haskell-cafe] another FFI question

2008-06-21 Thread Galchin, Vasili
On Sat, Jun 21, 2008 at 1:28 PM, Ryan Ingram <[EMAIL PROTECTED]> wrote: > You just have the arguments to "poke" wrong: > poke :: Storable a => Ptr a -> a -> IO () > > So you are missing the pointer argument > poke p Signal = poke p signal_int_value

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

2008-06-21 Thread Don Stewart
xj2106: > Hi, > > I'm wondering how usually you parse command line arguments > list safely. If the given argument is wrong, the program > can still print out some error information instead of giving > something like > > Prelude.read: no parse > > Let's make the discussion concrete. Suppose we

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

2008-06-21 Thread Neil Mitchell
Hi > I'm wondering how usually you parse command line arguments > list safely. If the given argument is wrong, the program > can still print out some error information instead of giving > something like Either use reads instead, and deal with the case where there is no parse. Or use the safe

[Haskell-cafe] Safe way to parse arguments?

2008-06-21 Thread Xiao-Yong Jin
Hi, I'm wondering how usually you parse command line arguments list safely. If the given argument is wrong, the program can still print out some error information instead of giving something like Prelude.read: no parse Let's make the discussion concrete. Suppose we have the following code. --

Re: [Haskell-cafe] ANNOUNCE: Pipe 1.0

2008-06-21 Thread Don Stewart
matti.niemenmaa+news: > Greetings, > > I hereby announce the release of the Pipe library, a library for piping > data through a pipeline of processes. > > A web page with (hopefully) all the necessary info and a simple example can > be found at http://iki.fi/matti.niemenmaa/pipe/ > > The packa

Re: [Haskell-cafe] another FFI question

2008-06-21 Thread Ryan Ingram
You just have the arguments to "poke" wrong: poke :: Storable a => Ptr a -> a -> IO () So you are missing the pointer argument poke p Signal = poke p signal_int_value I didn't know about the (#const) syntax. Interesting. Also, alignment of signal should match the alignment of the underlyi

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

2008-06-21 Thread Martin Blais
Hello Haskell community! I just did a marginally cool thing and I wanted to share it with you. "rst-literals" is a small program I wrote a while ago in order to write documents in reStructuredText format that would embed SQL code for data models in them, a form of literal programming for SQL if

Re: [Haskell-cafe] message passing style like in Haskell?

2008-06-21 Thread Ian Lynagh
On Fri, Jun 20, 2008 at 07:57:58AM +0200, Ketil Malde wrote: > "Albert Y. C. Lai" <[EMAIL PROTECTED]> writes: > > >> While we are kind of on this topic, what makes the characters ħ þ > >> prefix operator by default, while º and most other odd ones infix? > > > alphanumeric vs non-alphanumeric >

[Haskell-cafe] ANNOUNCE: Pipe 1.0

2008-06-21 Thread Matti Niemenmaa
Greetings, I hereby announce the release of the Pipe library, a library for piping data through a pipeline of processes. A web page with (hopefully) all the necessary info and a simple example can be found at http://iki.fi/matti.niemenmaa/pipe/ The package is at Hackage: http://hackage.has

Re: [Haskell-cafe] an example from YAHT doesn't run

2008-06-21 Thread Paulo Tanimoto
Hi Jared, 2008/6/21 <[EMAIL PROTECTED]>: > Guess.hs:19:12: parse error on input `doGuessing' > > Failed, modules loaded: none. " That says there's something wrong at line 19. In this case, 'doGuessing' is not properly aligned with 'putStrLn' of the previous line. The same happens at line 22.

[Haskell-cafe] an example from YAHT doesn't run

2008-06-21 Thread trifod
Hello, On pdf page 43 of YAHT it provides a code example. I typed this into a file named "Guess.hs" and tried unsuccessfully to load it into ghci. I am running ghci version 6.8.2 This is the output it gave me: " [1 of 1] Compiling Main ( Guess.hs, interpreted ) Guess.hs:19:12: parse error on inp

Re: [Haskell-cafe] Access to Oracle database from Haskell

2008-06-21 Thread Steve Lihn
Oracle OCI interface is quite different between 7/8 and 9/10. And 10 is different from 9 in some respect. I don't know much about 11. Oracle 10.2.0.3 is a stable release, but there are some major server bugs in it, that Oracle had to release 10.2.0.4. I'd recommend Haskell community to focus on 10.

Re: [Haskell-cafe] Access to Oracle database from Haskell

2008-06-21 Thread Paul Moore
2008/6/20 Alistair Bayley <[EMAIL PROTECTED]>: > Having just taken a closer took at what Oracle Instant Client is, I > suspect that you might have some trouble getting Takusen to compile > against it. The Instant Client lacks header files, while Takusen's FFI > imports specify oci.h. I don't know w

Re: [Haskell-cafe] Re: HDBC converting a date sql value to UTCTime

2008-06-21 Thread Jules Bean
George Moschovitis wrote: Alternatively is there a way to create a UTCTime value from an epoch integer (no of seconds since epoch). I can't find a suitable constructor with Hoogle. http://www.haskell.org/ghc/docs/latest/html/libraries/time/Data-Time-Clock-POSIX.html posixSecondsToUTCTime pro