Hello! It is I, your editor Jeremy Shaw. I am pleased to bring you Happstack Irregular News Issue #2. Some exciting things have happened since the last issue!
The biggest news since the last issue is the release of clckwrks:
clckwrks is a Haskell-based blog and CMS framework with support for editing pages via the browser plus downloadable themes and plugins.
clckwrks is now powering happstack.com and clckwrks.com.
We are currently focusing on making the clckwrks blogging portion solid. We have moved the official Happstack blog to clckwrks in order to encourage us to make it better :)
If you want to help out, you can browse our bug list and find something to take action on. We are more than happy to provide guidance and other assistance.
The other new big release was
reform. reform
is a form
generation library that continues in the footsteps of formlets
and
digestive-functors <= 0.2
. digestive-functors 0.3
has gone off to
explore a different direction, and we wanted to continue pushing the
development in this direction. There are still many ideas we can share
between the two libraries. Two changes we want to make in the next
release include:
switch to Bifunctors
package instead of homebrewed
IndexedApplicative
(thanks to Leonid Onokhov for pointing that
out). (Another alternative might be index-core
, though it does not
yet export the Applicative
instances).
consider using a Free Applicative
/ Operational Applicative
for
implementing the reform
applicative instances. digestive functors
0.3
does something like this and Jasper Van der Jeugt said it was
very beneficial and we should try it in reform
as well.
Dag Odenhall has released happstack-yui
, which makes it easy to use
YUI with Happstack. According the YUI website:
"YUI is a free, open source JavaScript and CSS framework for building richly interactive web applications."
Niklas Broberg and I (Jeremy Shaw) did some work on HSX. It now builds
with GHC 7.4 and we also fixed some hidden bugs in
HSX.Transform
. One thing we have been experimenting with is a
QuasiQuoter
for HSX. A demo version can be found here:
darcs get http://src.seereason.com/hsx-qq/
The QQ provides an alternative to the trhsx
preprocessor and
allows you to write things like:
html :: (XMLGenerator m) => XMLGenT m (XMLType m)
html = [hsx| <p class="foo"><% map toUpper "hello, world!" %></p> |]
This should be included in the next release of HSX.
The next release of HSX will also contain a major refactoring of the
packages. Mostly we are just planning to move modules into different
packages and divide things up differently. One major benefit of the
new arrangement is that you will no longer be required to install
HJavaScript
and HJScript
even though you probably never use them.
changed types in happstack-lite
so that serveFile
and asContentType
work better together, and added guessContentType
, MimeMap
, mimeType
patched happstack-jmacro
to work with older versions of template haskell
tweaks to ixset.cabal
so that it does not require the latest Cabal
to build
I have started research into why hackage2 requires so much RAM to run. I will be blogging about that separately. I do expect that we can substantially reduce that amount of RAM it requires. So far I have uncovered two minor issues:
it turns out that mapM Lazy.readFile fileList
returns the file
contents lazily but opens all the files immediately. This means you
can run out of file descriptors if you have a lot of checkpoints or
event files. A patch has been submitted for acid-state
and it will
be fixed in the next release.
acid-state
reads the entire checkpoint file into RAM before
decoding it. There are a couple places in the code that cause this to
happen. The first place is in cereal
. The getLazyByteString
function does return a lazy ByteString
.. but it does it by first
reading a strict ByteString
of the required length and then
converting it into a lazy ByteString
. Changing the behavior of
getLazyByteString
is actually quite difficult, as cereal
was
designed to allow for value-level error handling, instead of throwing
async exceptions.
We can probably work around this by using runGetState
to get
one-chunk at a time and build the lazy ByteString
that way. That
might actually be a lot less hackish than it sounds at first, because
it allows us to explicity detect and handle failure cases and control
how much and when things are read into RAM. Though, at that point, it
starts to feel a bit like enumerators/iteratee/etc. Perhaps we will
switch to pipes
at some point in time. pipes
provides streaming for
pure (non-IO) values -- which is probably what we want here.
Evan Czaplicki has been doing a ton of work on ELM recently. As described on the ELM Language Homepage:
"Elm is a type-safe, functional reactive language that compiles to HTML, CSS, and JavaScript."
It is easy to use ELM with Happstack -- no special support is
required. (i.e., we do not need happstack-elm
). Vincent Ambo has
created a simple demo here:
Vincent also wrote a nice blog post showing how to combine web-routes
(type-safe URL routing) with Hamlet
(a QuasiQuoter
for generating
blaze-html
from HTML-like syntax):
Best of both worlds: Using Hamlet and web-routes with Happstack
JMacro
is great for creating JavaScript, but we still have a hole
when it comes to generating CSS. The
language-css
library already contains combinators and a syntax ADT for CSS3.
If it had a parser, then we could also create a syntax-checking
[css| |]
QuasiQuoter
.
I have discussed the idea with Anton Kholomiov, and he is interested -- but we could use some one else to help write the parser. If you love writing parsers, this should be a fun little project.
Finally, if you could suggest one thing that would make the happstack.com website nicer that would be awesome. There are four things we already plan to change:
use black on white text instead of gray on white
fix the paragraph width so that paragraphs are around 45em wide.
fix the grid alignment so that things are properly aligned to the grid
add more dates to the pages so that it clear that the site and project is still active
If you have other suggestions, we would love to hear them! If you want to hack on the theme directly, that is even better!
Until next time, happy hacking.
Jeremy Shaw