safe-access-0.2.1.1: A simple environment to control access to data

Safe HaskellSafe-Inferred
LanguageHaskell2010

Control.SafeAccess

Synopsis

Documentation

ensureAccess :: MonadSafeAccess d m => d -> m () Source

Check that the access is legal or make the monad "fail".

newtype Capability d Source

Allow things to be accessed. See ensureAccess.

d is the type describing an access.

Constructors

MkCapability 

data AccessDecision Source

Control the decision process.

The constructors are ordered by prevalence. For instance, if two capabilities respectively return AccessGranted and AccessDenied, the final decision will be AccessDenied.

Constructors

AccessDeniedSoft

No but another Capability can still decide to grant

AccessGranted

Final yes (see explanation)

AccessDenied

Final no

newtype SafeAccessT d m a Source

A simple monad (transformer) to ensure that data are accessed legitimately.

The return value is either the description of an access having been denied (left) or the result of the normal computation (right).

Constructors

SafeAccessT 

Fields

runSafeAccessT :: Capabilities d -> m (Either d a)
 

liftExceptT :: ExceptT d m a -> SafeAccessT d m a Source

Lift an action from ErrorT to SafeAccessT.