Skip to content
January 2, 2011 / cdsmith

Update to Snap sessions package

I’ve been working furiously this weekend on the mysnapsession package that I announced a few days ago.  Version 0.3 is now released.

I’ve started an introduction to the package, with a getting started step by step process, links to online API documentation, etc.

https://patch-tag.com/r/cdsmith/mysnapsession/wiki/

A few highlights of this new release:

Client Side Sessions: I’ve provided a second implementation of sessions based entirely on cookies and Michael Snoyman’s clientsession package.  This was in the cards from the beginning, but it’s not my favorite choice, so it was second in the list of implementations.

Module Reorganization: I moved some modules around, in acknowledgement that the dialogues programming model is not actually a Snap extension.  Instead, it’s a library that builds on sessions.

Matching APIs with Ozataman’s Package: One of the bigger surprises was learning that ozataman is already working on a different sessions package for Snap.  Because of substantial design differences, I will still continue to develop my implementation anyway; but at least we can keep the exposed APIs similar.  As such, you’ll notice that MonadSession looks very similar between the two.  The differences are:

  1. Whereas ozataman defines the session type as a type alias at the top of the module, in my package it’s an associated type inside the MonadSession type class.
  2. Whereas ozataman defines setInSession, deleteFromSession, and getFromSession as members of MonadSession with default implementations, I define them as convenience functions following the MonadSession type class, and with somewhat more general types.

Aside from that, Snap.Extension.Session is basically the same between the two.  The implementations differ considerably.

About these ads

3 Comments

Leave a Comment
  1. Marek Sieradzki / Jan 3 2011 10:45 am

    I noticed that snap requires network-2.3. That’s quite painful since you only get 2.2.1.7 +network-bytestring with Haskell Platform on Windows. Does it really need new network package? As far as I remember API is the same.

    • cdsmith / Jan 3 2011 10:49 am

      I’m not familiar enough with snap-server to answer that question. Hopefully, the next release of the Haskell Platform will include network 2.3 instead? For now, I don’t have a good answer.

      Does cabal not cleanly install network 2.3 on Windows?

      • Marek Sieradzki / Jan 3 2011 4:27 pm

        It require autoconf and such and default installation of Haskell platform doesn’t include it so cabal dies at configure step of network-2.3.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 74 other followers

%d bloggers like this: