O'Reilly logo

Haskell Cookbook by Yogesh Sajanikar

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How it works...

In the preceding recipe, we took the following steps to store information in a session:

  • The withSession function introduces the session lens into the handler. At the end of the request, the withSession function commits the changes to the session.
  • The with function allows us to use the session functions in the handler.
  • The function setInSession allows us to set a key to the value that we would like.
  • The function getFromSession allows us to get a key if it is present in the session.
  • We use initCookieManager to initialize the cookie-based session manager supplied with the snap framework. The cookie manager is configured with site_key.txt, a file where a private encoding key for the session manager will be stored, the name of ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required