[Haskell-cafe] Should Yesod.Mail be a separate package?

2010-10-17 Thread Michael Snoyman
Hey all, I wrote a simple email module in Yesod[1] that handles such things as multipart messages and Base64 encoding. It's still missing some features (multipart/alternative, for instance), but it can be useful for throwing together emails. It's currently part of the yesod package, but I'm going

[Haskell-cafe] Re: Should Yesod.Mail be a separate package?

2010-10-17 Thread Kevin Jardine
Hi Michael, Last time I checked Hackage for email libraries I could find some basic SMTP systems but nothing very recent or robust. Practically every web app needs to send email, so I think that a robust and well maintained email package would be very useful. I know you have many other projects

Re: [Haskell-cafe] Re: Should Yesod.Mail be a separate package?

2010-10-17 Thread Robert Wills
Last summer I put cabalized HaskellNet (written by Jun Mukai for a GSOC) (http://hackage.haskell.org/package/HaskellNet) and uploaded it to hackage. I put myself down as a maintainer but I haven't done much maintaining. HaskellNet also does multipart mime and base64 stuff as well as imap and pop

[Haskell-cafe] Re: Should Yesod.Mail be a separate package?

2010-10-17 Thread Kevin Jardine
Hi Robert, I did look at HaskellNet a few months ago. It looked big and undocumented so I guess I got scared away. What I'd be interested in is something with the simplicity of the PHP mail command (or perhaps the phpmailer package). I dislike PHP as a programming language but it does basic

Re: [Haskell-cafe] ghci - always show types

2010-10-17 Thread Gaius Hammond
On 13 Oct 2010, at 16:55, Ozgur Akgun wrote: Cafe, Just a quick question. Either I am hallucinating or there was a way of saying ghci to always show types. It was working as if you typed :t it after every line of input. Sorry, I searched but couldn't find the option via google. Hope

Re: [Haskell-cafe] Systematic treatment of static arguments

2010-10-17 Thread Erik Hesselink
On Sat, Oct 16, 2010 at 21:39, Stephen Tetley stephen.tet...@gmail.com wrote: Hello list The Monad and Applicative instances for functions are equivalent to the respective Reader vesions (I use equivalent along the lines of - operationally the same but without the type distinction / newtype).

Re: [Haskell-cafe] Re: Should Yesod.Mail be a separate package?

2010-10-17 Thread Robert Wills
Yes you're right Kevin. I'll put up a new release sometime in the next week with some more examples and possible some simpler methods if only so HaskellNet can be more easily evaluated. As I recall Happstack also uses an smtp library. I forget which one. -Rob On Sun, Oct 17, 2010 at 9:29 AM,

Re: [Haskell-cafe] Text.Regex Segfault

2010-10-17 Thread Christopher Done
On 17 October 2010 04:45, Duane Johnson duane.john...@gmail.com wrote: I bumped into a segmentation fault in the regex library today and thought I'd warn others in case similar behavior is observed: Prelude :m Text.Regex Prelude Text.Regex map read (splitRegex (mkRegex \\|) 0|1|2|4) :: [Int]

[Haskell-cafe] Opening a gtk2hs link in default browser

2010-10-17 Thread Dmitry V'yal
Hello list, I'm trying to make a clickable link in gtk2hs program. Clicking it should open an url in the default browser. Can I hope to find some portable solution in gtk2hs (it should work in linux and windows) or should I start searching platform specific ones, like /usr/bin/xdg-open or

Re: [Haskell-cafe] Re: Proving stuff about IORefs

2010-10-17 Thread Malcolm Wallace
At any rate, if you intend to prove this for any arbitrary f, I can't tell you how to prove it formally because it's not true. How do you know that? Can you give an example where it fails? The problem with the code you originally posted was that it looked like this: f r = do r' -

Re: [Haskell-cafe] Proving stuff about IORefs

2010-10-17 Thread Miguel Mitrofanov
On 17 Oct 2010, at 05:21, Ben Franksen wrote: I want to prove that f r == do s1 - readIORef r r' - newIORef s1 x - f r' s3 - readIORef r' writeIORef r s3 return x That is not true. Consider the following function: g r1 r2 = writeIORef r1 0 writeIORef r2 1

Re: [Haskell-cafe] Proving stuff about IORefs

2010-10-17 Thread Derek Elkins
On Sun, Oct 17, 2010 at 6:49 AM, Miguel Mitrofanov miguelim...@yandex.ru wrote: On 17 Oct 2010, at 05:21, Ben Franksen wrote: I want to prove that  f r == do    s1 - readIORef r    r' - newIORef s1    x - f r'    s3 - readIORef r'    writeIORef r s3    return x That is not true.

Re: [Haskell-cafe] Systematic treatment of static arguments

2010-10-17 Thread Stephen Tetley
Hi Erik and wren Thanks for both messages. On 17 October 2010 10:12, Erik Hesselink hessel...@gmail.com wrote: [Snip] I think you can just use the original instance for Monoid for this. It declares instance Monoid b = Monoid a - b since 'b' can itself be a function (and r1 - r2 - a is

Re: [Haskell-cafe] Re: Proving stuff about IORefs

2010-10-17 Thread Ben Millwood
On Sun, Oct 17, 2010 at 11:15 AM, Malcolm Wallace malcolm.wall...@me.com wrote: The problem with the code you originally posted was that it looked like this:  f r = do r' - something           f r'           something else -- this is dead code That is, the computation is non-terminating,

[Haskell-cafe] Re: Opening a gtk2hs link in default browser

2010-10-17 Thread Andy Stewart
Hi Dmitry, Dmitry V'yal akam...@gmail.com writes: Hello list, I'm trying to make a clickable link in gtk2hs program. Clicking it should open an url in the default browser. Can I hope to find some portable solution in gtk2hs (it should work in linux and windows) or should I start

[Haskell-cafe] Re: Proving stuff about IORefs

2010-10-17 Thread Ben Franksen
Derek Elkins wrote: On Sun, Oct 17, 2010 at 6:49 AM, Miguel Mitrofanov miguelim...@yandex.ru wrote: On 17 Oct 2010, at 05:21, Ben Franksen wrote: I want to prove that f r == do s1 - readIORef r r' - newIORef s1 x - f r' s3 - readIORef r' writeIORef r s3 return x That is not true.

[Haskell-cafe] Re: Re: Proving stuff about IORefs

2010-10-17 Thread Ben Franksen
Ben Millwood wrote: On Sun, Oct 17, 2010 at 11:15 AM, Malcolm Wallace malcolm.wall...@me.com wrote: The problem with the code you originally posted was that it looked like this: f r = do r' - something f r' something else -- this is dead code That is, the computation is non-terminating,

Re: [Haskell-cafe] UTF-8 problems when decoding JSON data coming from Network.HTTP

2010-10-17 Thread Ionut G. Stan
On 17/Oct/10 8:02 AM, Michael Snoyman wrote: In the gist you sent, the problem is that you are reading the HTTP response as a String. The HTTP library doesn't deal well with non-Latin characters when doing String requests; you should be using ByteString and then converting. It's a little tedious

Re: [Haskell-cafe] Proving stuff about IORefs

2010-10-17 Thread Matthew Brecknell
Hi Ben, Ben Franksen wrote: Suppose we have a function f :: IORef a - IO b I want to prove that f r == do s1 - readIORef r r' - newIORef s1 x - f r' s3 - readIORef r' writeIORef r s3 return x I'm not sure where in your question the quantifiers for

[Haskell-cafe] Heterogenous network stream

2010-10-17 Thread Charles-Pierre Astolfi
Hi cafe, I'd like to implement a toy-protocol and I'm looking for the sanest way (for me) to do so. Here's what it looks like: The server receives, in that order: - Ascii string (4 bytes) - 16 bits int (2 bytes) - 8 bits int (1 byte) - UTF8 string (128 bytes) I tried to use hGetBuf, but I don't

Re: [Haskell-cafe] UTF-8 problems when decoding JSON data coming from Network.HTTP

2010-10-17 Thread Ionut G. Stan
On 17/Oct/10 3:37 PM, Michael Snoyman wrote: On Sun, Oct 17, 2010 at 2:26 PM, Ionut G. Stanionut.g.s...@gmail.com wrote: Thanks Michael, now it works indeed. But I don't understand, is there any inherent problem with Haskell's built-in String? Should one choose ByteString when dealing with

[Haskell-cafe] Re: Should Yesod.Mail be a separate package?

2010-10-17 Thread Kevin Jardine
Something along the lines of these examples would be helpful I think: http://phpmailer.worxware.com/index.php?pg=examples Phpmailer is probably the most widely used email library, so if it could be shown that there was a Haskell equivalent (or better), I think that might start attracting the

Re: [Haskell-cafe] Re: Should Yesod.Mail be a separate package?

2010-10-17 Thread Edward Z. Yang
I'm a bit partial to Swift Mailer [1]. It's useful to support multiple transport backends, especially in situations where sendmail is not portable. Cheers, Edward [1] http://swiftmailer.org/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] Re: Should Yesod.Mail be a separate package?

2010-10-17 Thread Michael Snoyman
OK, I've put together a new repository on github[1]. I've modified the original code from Yesod to now include support for multipart/alternative, and to only create a multipart when there really are multiple parts. I've done some simple tests, and it seems to work just fine. Now a question for

Re: [Haskell-cafe] UTF-8 problems when decoding JSON data coming from Network.HTTP

2010-10-17 Thread Mark Lentczner
On Oct 17, 2010, at 5:37 AM, Michael Snoyman mich...@snoyman.com wrote: in the case of JSON, I believe this is always specified as UTF-8. RFC 4627 section 3 says that JSON must be encoded in Unicode, but all encodings are acceptable. The encoding is inferred by the firsthand four octets. So you

Re: [Haskell-cafe] Eta-expansion and existentials (or: types destroy my laziness)

2010-10-17 Thread Roman Leshchinskiy
On 16/10/2010, at 12:36, Max Bolingbroke wrote: On 16 October 2010 12:16, Roman Leshchinskiy r...@cse.unsw.edu.au wrote: eta :: Stream a - Stream a eta s = Stream s next where next (Stream s next') = case next' s of Just (x,s') - Just (x,Stream s' next')

Re: [Haskell-cafe] Re: Should Yesod.Mail be a separate package?

2010-10-17 Thread Jeremy Shaw
On Sun, Oct 17, 2010 at 10:14 AM, Michael Snoyman mich...@snoyman.com wrote: I'm sure people would love to see built-in support for serving over SMTP, but I think that's more appropriate for a different package. Proper SMTP support will also include SSL/TLS support, which will require even

[Haskell-cafe] Compiling a DSL on the shoulders of GHC

2010-10-17 Thread Patai Gergely
Hello all, I'm trying to reuse as much of the sweat and tear put into GHC as possible to derive a compiler for a language highly similar to Haskell in many aspects. The difference is that instead of constructing an expression of type IO (), the programmer has to provide a stream processor on the

Re: [Haskell-cafe] Compiling a DSL on the shoulders of GHC

2010-10-17 Thread Henning Thielemann
On Sun, 17 Oct 2010, Patai Gergely wrote: I'm trying to reuse as much of the sweat and tear put into GHC as possible to derive a compiler for a language highly similar to Haskell in many aspects. The difference is that instead of constructing an expression of type IO (), the programmer has to

[Haskell-cafe] Re: MonadCatchIO, finally and the error monad

2010-10-17 Thread Arie Peterson
On Thu, 14 Oct 2010 12:01:59 +0200, Michael Snoyman mich...@snoyman.com wrote: [...] which I believe is a flawed design in the MonadCatchIO-transformers package. Here are my thoughts on this and what I think needs to be done to fix it. [...] Try running the code with each version of go

Re: [Haskell-cafe] Compiling a DSL on the shoulders of GHC

2010-10-17 Thread Patai Gergely
And it is not enough to provide just a driver function, that is called in 'main', say run :: IOArrow a b - a - IO b ? No, because I need to compile the stream processing program itself by a different tool. I just want to trick GHC into doing much of the weightlifting. No IO monad is

[Haskell-cafe] concurrency vs. I/O in GHC

2010-10-17 Thread Donn Cave
As I have migrated more of my application into Haskell, I find that I/O in one thread effectively blocks other threads. That's rather the opposite of what I need - I don't care so much if Haskell threads manage to compute in parallel, but the application should continue to function, in other

[Haskell-cafe] Re: Strict Core?

2010-10-17 Thread Stefan Monnier
That said, I've been told that UHC's core language uses the ideas from Strict Core, and they have/had a student at Utretch (Tom Lokhorst) who was working on implementing optimisations like arity raising and deep unboxing for the language. Many/most implementations of ML-ish languages use a

[Haskell-cafe] Re: A rant against the blurb on the Haskell front page

2010-10-17 Thread Stefan Monnier
Good start, if only the advanced were replaced with something more characteristic, like lazy, or statically typed. Which, BTW, both do not appear in the whole blurb, even though they are *the* characteristics of Haskell, lazyness being even something that sets it apart from most other

Re: [Haskell-cafe] A rant against the blurb on the Haskell front page

2010-10-17 Thread Henning Thielemann
Ketil Malde schrieb: Don Stewart d...@galois.com writes: Good start, if only the advanced were replaced with something more characteristic, like lazy, or statically typed. Which, BTW, both do not lazy and statically typed don't mean much to other people. They are buzz words that mean

Re: [Haskell-cafe] Re: A rant against the blurb on the Haskell front page

2010-10-17 Thread Jeremy Shaw
On Sun, Oct 17, 2010 at 1:32 PM, Stefan Monnier monn...@iro.umontreal.ca wrote: AFAIK laziness is a property of the major implementations of Haskell, but not really of the language itself.  All I see in the Haskell report points at it being applicative, call by name, but nowhere does the

[Haskell-cafe] Haskell Front Page Ideas

2010-10-17 Thread caseyh
How about a bullet list of Haskell's features (maybe pros cons) might be better; followed by a list of a few other languages and their trade-offs. As Jon Bentley has said, design is usually trade-offs but when you can come up with something that is a mutual benefit; so much the better.

Re: [Haskell-cafe] Re: MonadCatchIO, finally and the error monad

2010-10-17 Thread Antoine Latter
On Sun, Oct 17, 2010 at 1:04 PM, Arie Peterson ar...@xs4all.nl wrote: On Thu, 14 Oct 2010 12:01:59 +0200, Michael Snoyman mich...@snoyman.com wrote: [...] which I believe is a flawed design in the MonadCatchIO-transformers package. Here are my thoughts on this and what I think needs to be

Re: [Haskell-cafe] Re: Should Yesod.Mail be a separate package?

2010-10-17 Thread Donn Cave
Quoth Jeremy Shaw jer...@n-heptane.com, ... I wonder what it would take to make it so that the message body could be multipart mime... Well, here's what it takes for me - - function to determine file type of attachment (e.g., image/jpeg) - data encoding (base64, maybe quoted-printable, others)

Re: [Haskell-cafe] Compiling a DSL on the shoulders of GHC

2010-10-17 Thread Luke Palmer
On Sun, Oct 17, 2010 at 12:12 PM, Patai Gergely patai_gerg...@fastmail.fm wrote: And it is not enough to provide just a driver function, that is called in 'main', say    run :: IOArrow a b - a - IO b ? No, because I need to compile the stream processing program itself by a different tool.

Re: [Haskell-cafe] concurrency vs. I/O in GHC

2010-10-17 Thread Gregory Collins
Donn Cave d...@avvanta.com writes: As I have migrated more of my application into Haskell, I find that I/O in one thread effectively blocks other threads. That's rather the opposite of what I need - I don't care so much if Haskell threads manage to compute in parallel, but the application

Re: [Haskell-cafe] Compiling a DSL on the shoulders of GHC

2010-10-17 Thread Patai Gergely
Not sure how this fits into what I thought you were saying. Are you trying to use Haskell to build an AST, use GHC to optimize it, and then spit it out and compile it with, say, a OCaml program that you have already written? Yes, that would be the basic idea: 1. Compile the Haskell

Re: [Haskell-cafe] Re: Strict Core?

2010-10-17 Thread Tom Lokhorst
Note that in my experience working on SML/NJ's optimizer (using wrapper+inlining), such an approach to code transformation doesn't care about types at all, and indeed most/all of what tacc-hs09.pdf presents is mostly unrelated to whether the language is typed: e.g. the uncurrying of the

Re: [Haskell-cafe] Haskell Front Page Ideas

2010-10-17 Thread aditya siram
An honest list of cons mentioned up-front is a great idea and would attract me to a language. It shows me that the community is grounded, active , pragmatic and helpful. -deech On Sun, Oct 17, 2010 at 1:45 PM, cas...@istar.ca wrote: How about a bullet list of Haskell's features (maybe pros

Re: [Haskell-cafe] A rant against the blurb on the Haskell front page

2010-10-17 Thread Jeremy Shaw
On Sat, Oct 16, 2010 at 3:02 AM, Stephen Tetley stephen.tet...@gmail.com wrote: If a functional language doesn't mean anything significant then Haskell probably isn't the language you should be choosing. People who don't know what 'functional language' means can still get all the benefits of

[Haskell-cafe] Text: find

2010-10-17 Thread Antoine Latter
On Sun, Oct 17, 2010 at 3:25 PM, Bryan O'Sullivan b...@serpentine.com wrote: On Mon, Oct 11, 2010 at 1:12 PM, Malcolm Wallace malcolm.wall...@me.com wrote:  find        find      find           (Text - Bool) - Text - Maybe Text Proposal: rename Text.findBy to Text.find. I agree with the

Re: [Haskell-cafe] Haskell Front Page Ideas

2010-10-17 Thread Jeremy Shaw
On Sun, Oct 17, 2010 at 3:11 PM, aditya siram aditya.si...@gmail.com wrote: An honest list of cons mentioned up-front is a great idea and would attract me to a language. It shows me that the community is grounded, active , pragmatic and helpful. Yes. It's called damaging admission, and

[Haskell-cafe] Re: Text: find

2010-10-17 Thread Bryan O'Sullivan
On Sun, Oct 17, 2010 at 1:51 PM, Antoine Latter aslat...@gmail.com wrote: What would the definition of a function of the form: find :: (Text - Bool) - Text - Maybe Text look like? Can you be more specific? I assume you mean that the only sensible return values are Nothing or the entire

Re: [Haskell-cafe] Re: Text: find

2010-10-17 Thread Luke Palmer
On Sun, Oct 17, 2010 at 4:05 PM, Bryan O'Sullivan b...@serpentine.com wrote: On Sun, Oct 17, 2010 at 1:51 PM, Antoine Latter aslat...@gmail.com wrote: What would the definition of a function of the form: find :: (Text - Bool) - Text - Maybe Text look like? Can you be more specific? I

[Haskell-cafe] Re: Proving stuff about IORefs

2010-10-17 Thread Ben Franksen
Hi Mathew Matthew Brecknell wrote: Ben Franksen wrote: Suppose we have a function f :: IORef a - IO b I want to prove that f r == do s1 - readIORef r r' - newIORef s1 x - f r' s3 - readIORef r' writeIORef r s3 return x I'm not sure where in your

Re: [Haskell-cafe] An interesting paper on VM-friendly GC

2010-10-17 Thread Richard O'Keefe
On 16/10/2010, at 10:35 PM, Andrew Coppin wrote: Also, it's news to me that Java finds heavy use anywhere yet. (Then again, if they run Java server-side, how would you tell?) Java seems to be used heavily for developing mobile phone applications (other than iPhone, of course). My young

Re: [Haskell-cafe] concurrency vs. I/O in GHC

2010-10-17 Thread Donn Cave
[I wrote initially, ...] As I have migrated more of my application into Haskell, I find that I/O in one thread effectively blocks other threads. Resolved - the SSL_read external I/O function needs to be safe. My apologies for botching the mailing list threading, but I deleted the mail wherein

Re: [Haskell-cafe] An interesting paper on VM-friendly GC

2010-10-17 Thread Nathan Howell
On Sat, Oct 16, 2010 at 8:45 AM, Brandon S Allbery KF8NH allb...@ece.cmu.edu wrote: I thought Windows already had a system message for something like that.  Or at least it used to, although I can see why it would have been removed or at least deprecated. You're probably thinking of