Re: [Haskell-cafe] Re: ANNOUNCE: happstack 0.5.0

2010-05-05 Thread Jeremy Shaw


On May 4, 2010, at 11:20 PM, Michael Snoyman wrote:


Hey Jeremy,

I see below that you included the experimental WAI support. I'm  
excited to try it out, but I don't see it in happstack-server (maybe  
I'm blind). Could you point it out?


Hello,

I should have been more explicit about this, sorry about that. The  
experimental WAI support is only available via darcs, in the happstack- 
wai sub-directory.


darcs get http://patch-tag.com/r/mae/happstack
cd happstack/happstack-wai

You can browse here:

http://www.patch-tag.com/r/mae/happstack/snapshot/current/content/pretty/happstack-wai

The core is mostly there, though it is missing some of the Guards, and  
the FileServe module.


Probably less than a day to finish it off I guess. Would be nice to  
do that now that 0.5 is out.


The happstack-wai version would not be a drop-in replacement for  
happstack-server. There are some differences, such as the wai version  
supporting enumerators :) But, porting from happstack-server to  
happstack-wai should not require major changes.


What remains to be seen is if happstack-wai actually provides better  
performance than happstack-server.


alas, there is no happstack-wai specific demo at the moment. But, if  
there was, it would look a lot like a normal happstack-server app...


- jeremy ___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: ANNOUNCE: happstack 0.5.0

2010-05-05 Thread Michael Snoyman
On Wed, May 5, 2010 at 2:41 PM, Jeremy Shaw jer...@n-heptane.com wrote:


 On May 4, 2010, at 11:20 PM, Michael Snoyman wrote:

 Hey Jeremy,

 I see below that you included the experimental WAI support. I'm excited to
 try it out, but I don't see it in happstack-server (maybe I'm blind). Could
 you point it out?


 Hello,

 I should have been more explicit about this, sorry about that. The
 experimental WAI support is only available via darcs, in the happstack-wai
 sub-directory.

 darcs get http://patch-tag.com/r/mae/happstack
 cd happstack/happstack-wai

 You can browse here:


 http://www.patch-tag.com/r/mae/happstack/snapshot/current/content/pretty/happstack-wai

 The core is mostly there, though it is missing some of the Guards, and the
 FileServe module.

 Probably less than a day to finish it off I guess. Would be nice to do
 that now that 0.5 is out.

 The happstack-wai version would not be a drop-in replacement for
 happstack-server. There are some differences, such as the wai version
 supporting enumerators :) But, porting from happstack-server to
 happstack-wai should not require major changes.

 What remains to be seen is if happstack-wai actually provides better
 performance than happstack-server.

 alas, there is no happstack-wai specific demo at the moment. But, if there
 was, it would look a lot like a normal happstack-server app...

 - jeremy


It wouldn't look like a normal WAI app? If you want something like that,
Simon Hengel wrote a nice Hello World for WAI; it's available in the github
repo[1].

As far as performance goes, I can't imagine you'd see any significant
difference without an enumerator-biased test, but I could be wrong. If you
want to try something, I'd suggest outputting the contents of a file
(obviously without the sendfile syscall). If you want help writing a WAI
version, let me know, I'd be interested in the results of a comparison.

Michael

[1] http://github.com/snoyberg/wai/blob/master/README.lhs
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: ANNOUNCE: happstack 0.5.0

2010-05-05 Thread Jeremy Shaw


On May 5, 2010, at 8:01 AM, Michael Snoyman wrote:


alas, there is no happstack-wai specific demo at the moment. But, if  
there was, it would look a lot like a normal happstack-server app...


It wouldn't look like a normal WAI app? If you want something like  
that, Simon Hengel wrote a nice Hello World for WAI; it's available  
in the github repo[1].




Actually, I am wrong, I did have a little demo app:

http://www.patch-tag.com/r/mae/happstack/snapshot/current/content/pretty/happstack-wai/Main.hs

It looks exactly like a normal happstack app, and offers no clues that  
it is WAI based.


main :: IO ()
main = simpleHTTP 8000 $
   msum [ dir foo $ ok $ toResponse foo -- handles /foo
, dir bar $ ok $ toResponse bar -- handles /bar
, do nullDir-- handles /
 ok $ toResponse hello
, notFound $ toResponse Invalid URL -- handles anything  
else

]

In this demo, the routing  dispatching is handled by the filter  
combinators such as 'dir' and 'nullDir' (there are also ones like  
'path' which can be used for path components which represent  
'variable' components such as integers). The combinators are based  
around MonadPlus -- hence the use of msum to combine them. They are  
tried in the order presented until one matches completely and returns  
a 'Response'. Of course, we could use web-routes instead.


the functions like, 'ok' and 'notFound' take care of setting the  
response code.


The 'toResponse' function takes care of converting the values (in this  
case strings) to a 'Response', and setting the Content-type.


There are other features not shown here, such as looking up values  
submitted as POST data , via the query string, or as cookies. There is  
also stuff for dealing with exceptions, escaping early and returning a  
Response, ways to apply filters (such as gzip compression), ways to  
add on-the-fly validation (of html or other content types), and more!


It is this high-level interface that makes happstack-server  
interesting. Hence the interest in using WAI for the 'backend' stuff  
that isn't really all that visible in the first place.



As far as performance goes, I can't imagine you'd see any  
significant difference without an enumerator-biased test, but I  
could be wrong. If you want to try something, I'd suggest outputting  
the contents of a file (obviously without the sendfile syscall). If  
you want help writing a WAI version, let me know, I'd be interested  
in the results of a comparison.


As for 'performance', there is the raw speed. But also issues like  
stability and reliability. And bugs. Or fixes for real-world usage.  
For example, implementing cookie handling by the spec does not quite  
work. There are some workarounds needed to handle cookies issued by  
google. And webkit and chrome browsers have issues with double quotes  
around the domain. Of course, these are also the reasons, ultimately,  
to use WAI. Instead of everyone having to learn that cookies are  
broken, and fix them in every framework, we can just do the hacks  
once, and everyone wins.


- jeremy
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: ANNOUNCE: happstack 0.5.0

2010-05-04 Thread Michael Snoyman
Hey Jeremy,

I see below that you included the experimental WAI support. I'm excited to
try it out, but I don't see it in happstack-server (maybe I'm blind). Could
you point it out?

Thanks,
Michael

On Mon, May 3, 2010 at 8:57 PM, Jeremy Shaw jer...@n-heptane.com wrote:

 (Note: Reply-to is set to haskell-cafe@haskell.org)

 Hello,

 I am very pleased to announce Happstack 0.5.0. It should install cleanly
 from hackage via:

  cabal install happstack

 If it does not, please report errors to the happstack mailing list:

 http://groups.google.com/group/HAppS

 (You will, unfortunately, need to be subscribed due to SPAM issues).

 Here are the official release notes:

 Release Notes:

   This release should fix many (hopefully all) known cabal install
   related issues. It also includes many other improvements detailed
   below.

 Known issues:

   * dropped support for GHC 6.8. GHC 6.10 and 6.12 currently supported.

   * happstack-data compiled with -O0 due to bug in cabal
  http://thread.gmane.org/gmane.comp.lang.haskell.cafe/69215

  You may be able to change that to -O2 if you first do:

cabal install --reinstall syb-with-class --disable-documentation

  But we need a solution that works automatically when people run, cabal
 install happstack.

 Changes since 0.4.1:

   * many IxSet improvements by Gracjan Polak

 - hide IxSet constructor. use ixSet instead.
 - improved efficiency of gteTLE, getGTE, and getRange
 - get rid of Dynamic, just use Data.Typeable (internal change)
 - added deleteIx
 - Eq and Ord instances for IxSet
 - removed a bunch of cruft
 - greatly improved documentation
 - added stats function
 - Protect user from using unindexed keys in searches in IxSet
 - Runtime safeguard for badly formed inferIxSet indexes
 - Fixed IxSet Default instance
 - More detailed error messages in IxSet

   * work around bug in bytestring which causes the server to hang
 (http://hackage.haskell.org/trac/ghc/ticket/3808)

   * support for uincode Text and lazy Text types

 - Serialize/Version instances now provided automatically by
 happstack-data
 - instances of EmbedAsChild and EmbedAsAttr for Text for Identity,
   IdentityT, ServerPartT, and WebT.
 - patches sent upstream to HSP, waiting on acceptance

   * Added Serialize/Version instances for time / Data.Time library

   * Improvements to GuestBook demo by Gracjan Polak
 - better handling of Ctrl-C
 - simplified .cabal to only build executable

   * Improvements to GuestBook demo by Gracjan Polak
 - nice command line interface with help message and version information
 - restructured parsing of command line to make it scale better with
   further parameters
 - added reference to Paths_guestbook module to enable incorporating
 version
   and path information generated by cabal.
 - added withLogger transformer guaranteeing clean setup and
   teardown of loggers
 - Added clean shutdown to logging component.

   * fail instance for WebT now includes location of pattern match failure.
 e.g.

   src\AppControl.hs:43:24: Pattern match failure in do expression

   * added expireCookie function

   * Improvements to documentation
   * Additional test cases
   * Fixes many build failures

   * Experimental: Added proof of concept port of happstack-server to WAI.
 http://www.haskell.org/pipermail/haskell-cafe/2010-March/074142.html

   * added 'dirs' guard. (Similar to dir, but for a list of path
 components).

   * set SO_KEEPALIVE so that dropped connections will eventually time out

   * happstack-util only depends on QuickCheck when compiled with
 -ftests. This is wrong but solves a lot of annoy install failures.

   * file serve functions now use MonadPlus instead of setting explicit 404

   * XMLMetaData for webHSP

   * Allow colons in cookie names

 Contributors:

  A big thanks to everyone who contributed patches for this release,
 including:

   Gracjan Polak (25 patches in this release!)
   Simon Meier
   Paulo Tanimoto
   Joachim Fasting
   Antoine Latter
   Simon Michael
   Adam Vogt
   Joe Edmonds
   Andrea Vezzosi
   Nils Schweinsberg

  --
 You received this message because you are subscribed to the Google Groups
 HAppS group.
 To post to this group, send email to ha...@googlegroups.com.
 To unsubscribe from this group, send email to
 happs+unsubscr...@googlegroups.com happs%2bunsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/happs?hl=en.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe