Permalink
Browse files

Export ISessionManager internals from its own module

ISessionManager typeclass functions are low level are not intended for
use by end users of Session or any of its backends. Since some
functions have names that clash with Prelude exports, it is better to
expose them from a separate module that's meant to be used by backend devs.
  • Loading branch information...
1 parent f36beff commit 987be67c7a1cb89fc476a2fd74b9d2f5b244ab2d @ozataman ozataman committed Jun 27, 2012
View
@@ -81,35 +81,35 @@ Library
exposed-modules:
Snap,
- Snap.Snaplet,
- Snap.Snaplet.Heist,
- Snap.Snaplet.Auth,
- Snap.Snaplet.Auth.Backends.JsonFile,
- Snap.Snaplet.Config,
- Snap.Snaplet.Session,
- Snap.Snaplet.Session.Common,
+ Snap.Snaplet
+ Snap.Snaplet.Heist
+ Snap.Snaplet.Auth
+ Snap.Snaplet.Auth.Backends.JsonFile
+ Snap.Snaplet.Config
+ Snap.Snaplet.Session
+ Snap.Snaplet.Session.Common
+ Snap.Snaplet.Session.SessionManager
Snap.Snaplet.Session.Backends.CookieSession
other-modules:
- Control.Access.RoleBased.Checker,
- Control.Access.RoleBased.Role,
- Control.Access.RoleBased.Types,
- Control.Access.RoleBased.Internal.Role,
- Control.Access.RoleBased.Internal.RoleMap,
- Control.Access.RoleBased.Internal.Rule,
- Control.Access.RoleBased.Internal.Types,
- Snap.Snaplet.Auth.AuthManager,
- Snap.Snaplet.Auth.Types,
- Snap.Snaplet.Auth.Handlers,
- Snap.Snaplet.Auth.SpliceHelpers,
- Snap.Snaplet.HeistNoClass,
- Snap.Snaplet.Internal.Initializer,
- Snap.Snaplet.Internal.LensT,
- Snap.Snaplet.Internal.Lensed,
- Snap.Snaplet.Internal.RST,
+ Control.Access.RoleBased.Checker
+ Control.Access.RoleBased.Role
+ Control.Access.RoleBased.Types
+ Control.Access.RoleBased.Internal.Role
+ Control.Access.RoleBased.Internal.RoleMap
+ Control.Access.RoleBased.Internal.Rule
+ Control.Access.RoleBased.Internal.Types
+ Snap.Snaplet.Auth.AuthManager
+ Snap.Snaplet.Auth.Types
+ Snap.Snaplet.Auth.Handlers
+ Snap.Snaplet.Auth.SpliceHelpers
+ Snap.Snaplet.HeistNoClass
+ Snap.Snaplet.Internal.Initializer
+ Snap.Snaplet.Internal.LensT
+ Snap.Snaplet.Internal.Lensed
+ Snap.Snaplet.Internal.RST
Snap.Snaplet.Internal.Types
- Snap.Snaplet.Session.SecureCookie,
- Snap.Snaplet.Session.SessionManager
+ Snap.Snaplet.Session.SecureCookie
if !os(windows)
build-depends:
@@ -1,6 +1,5 @@
module Snap.Snaplet.Session
- ( SessionManager(..)
- , ISessionManager(..)
+ ( SessionManager
, withSession
, commitSession
, setInSession
@@ -11,21 +10,22 @@ module Snap.Snaplet.Session
, resetSession
, touchSession
+ -- * Utilities Exported For Convenience
, module Snap.Snaplet.Session.Common
, module Snap.Snaplet.Session.SecureCookie
) where
------------------------------------------------------------------------------
import Control.Monad.State
import Data.Lens.Lazy
-import Data.Text (Text)
+import Data.Text (Text)
import Snap.Core
------------------------------------------------------------------------------
import Snap.Snaplet
import Snap.Snaplet.Session.Common
import Snap.Snaplet.Session.SecureCookie
-import Snap.Snaplet.Session.SessionManager
- ( SessionManager(..), ISessionManager(..) )
+import Snap.Snaplet.Session.SessionManager
+ ( ISessionManager(..), SessionManager(..) )
import qualified Snap.Snaplet.Session.SessionManager as SM
------------------------------------------------------------------------------
@@ -1,7 +1,7 @@
------------------------------------------------------------------------------
-{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE OverloadedStrings #-}
module Snap.Snaplet.Session.Backends.CookieSession
( initCookieSessionManager
@@ -10,19 +10,21 @@ module Snap.Snaplet.Session.Backends.CookieSession
------------------------------------------------------------------------------
import Control.Applicative
import Control.Monad.Reader
-import Data.ByteString (ByteString)
+import Data.ByteString (ByteString)
import Data.Generics
-import Data.HashMap.Strict (HashMap)
-import qualified Data.HashMap.Strict as HM
-import Data.Hashable (Hashable)
-import Data.Serialize (Serialize)
-import qualified Data.Serialize as S
-import Data.Text (Text)
-import Snap.Core (Snap)
+import Data.HashMap.Strict (HashMap)
+import qualified Data.HashMap.Strict as HM
+import Data.Hashable (Hashable)
+import Data.Serialize (Serialize)
+import qualified Data.Serialize as S
+import Data.Text (Text)
+import Snap.Core (Snap)
import Web.ClientSession
------------------------------------------------------------------------------
import Snap.Snaplet
import Snap.Snaplet.Session
+import Snap.Snaplet.Session.SessionManager
+-------------------------------------------------------------------------------
------------------------------------------------------------------------------
@@ -1,16 +1,30 @@
{-# LANGUAGE ExistentialQuantification #-}
+{-| This module is meant to be used mainly by Session backend
+developers, who would naturally need access to ISessionManager class
+internals. You can also use it if you need low-level access to the
+backend functionality.-}
+
module Snap.Snaplet.Session.SessionManager where
+-------------------------------------------------------------------------------
import Data.Text (Text)
-import Prelude hiding (lookup)
-
+import Prelude hiding (lookup)
+-------------------------------------------------------------------------------
import Snap.Core (Snap)
+-------------------------------------------------------------------------------
+
--- | Any Haskell record that is a member of the 'ISessionManager' typeclass
--- can be stuffed inside a 'SessionManager' to enable all session-related
--- functionality.
+-- | Any Haskell record that is a member of the 'ISessionManager'
+-- typeclass can be stuffed inside a 'SessionManager' to enable all
+-- session-related functionality.
+--
+-- To use sessions in your application, just find a Backend that would
+-- produce one for you inside of your 'Initializer'. See
+-- 'initCookieSessionManager' in
+-- 'Snap.Snaplet.Session.Backends.CookieSession' for a built-in option
+-- that would get you started.
data SessionManager = forall a. ISessionManager a => SessionManager a

0 comments on commit 987be67

Please sign in to comment.