From 29f8e64e1c91cb2107be471fc9efc344de7f899e Mon Sep 17 00:00:00 2001 From: aaron levin Date: Wed, 17 Feb 2016 22:01:54 +0100 Subject: [PATCH] Add Experimental warnings on combinators --- servant-client/src/Servant/Common/Auth.hs | 6 ++++++ servant-server/src/Servant/Server/Internal/Auth.hs | 5 +++++ servant/servant.cabal | 2 +- servant/src/Servant/{ => Experimental}/API/Auth.hs | 2 ++ 4 files changed, 14 insertions(+), 1 deletion(-) rename servant/src/Servant/{ => Experimental}/API/Auth.hs (86%) diff --git a/servant-client/src/Servant/Common/Auth.hs b/servant-client/src/Servant/Common/Auth.hs index 5e450bd8..9bcef932 100644 --- a/servant-client/src/Servant/Common/Auth.hs +++ b/servant-client/src/Servant/Common/Auth.hs @@ -15,15 +15,21 @@ import Servant.Common.Req (Req) -- | For a resource protected by authentication (e.g. AuthProtect), we need -- to provide the client with some data used to add authentication data -- to a request +-- +-- NOTE: THIS API IS EXPERIMENTAL AND SUBJECT TO CHANGE type family AuthClientData a :: * -- | For better type inference and to avoid usage of a data family, we newtype -- wrap the combination of some 'AuthClientData' and a function to add authentication -- data to a request +-- +-- NOTE: THIS API IS EXPERIMENTAL AND SUBJECT TO CHANGE newtype AuthenticateReq a = AuthenticateReq { unAuthReq :: (AuthClientData a, AuthClientData a -> Req -> Req) } -- | Handy helper to avoid wrapping datatypes in tuples everywhere. +-- +-- NOTE: THIS API IS EXPERIMENTAL AND SUBJECT TO CHANGE mkAuthenticateReq :: AuthClientData a -> (AuthClientData a -> Req -> Req) -> AuthenticateReq a diff --git a/servant-server/src/Servant/Server/Internal/Auth.hs b/servant-server/src/Servant/Server/Internal/Auth.hs index e9c69db8..f3428a93 100644 --- a/servant-server/src/Servant/Server/Internal/Auth.hs +++ b/servant-server/src/Servant/Server/Internal/Auth.hs @@ -16,12 +16,17 @@ import Servant.Server.Internal.ServantErr (ServantErr) -- | Specify the type of data returned after we've authenticated a request. -- quite often this is some `User` datatype. +-- +-- NOTE: THIS API IS EXPERIMENTAL AND SUBJECT TO CHANGE type family AuthServerData a :: * -- | Handlers for AuthProtected resources +-- +-- NOTE: THIS API IS EXPERIMENTAL AND SUBJECT TO CHANGE newtype AuthHandler r usr = AuthHandler { unAuthHandler :: r -> ExceptT ServantErr IO usr } deriving (Generic, Typeable) +-- | NOTE: THIS API IS EXPERIMENTAL AND SUBJECT TO CHANGE mkAuthHandler :: (r -> ExceptT ServantErr IO usr) -> AuthHandler r usr mkAuthHandler = AuthHandler diff --git a/servant/servant.cabal b/servant/servant.cabal index a83d4830..fc2dec36 100644 --- a/servant/servant.cabal +++ b/servant/servant.cabal @@ -26,7 +26,6 @@ source-repository head library exposed-modules: Servant.API - Servant.API.Auth Servant.API.Alternative Servant.API.BasicAuth Servant.API.Capture @@ -44,6 +43,7 @@ library Servant.API.Vault Servant.API.Verbs Servant.API.WithNamedContext + Servant.API.Experimental.Auth Servant.Utils.Links build-depends: base >=4.7 && <5 diff --git a/servant/src/Servant/API/Auth.hs b/servant/src/Servant/Experimental/API/Auth.hs similarity index 86% rename from servant/src/Servant/API/Auth.hs rename to servant/src/Servant/Experimental/API/Auth.hs index e1485b15..0647b012 100644 --- a/servant/src/Servant/API/Auth.hs +++ b/servant/src/Servant/Experimental/API/Auth.hs @@ -8,5 +8,7 @@ import Data.Typeable (Typeable) -- | A generalized Authentication combinator. Use this if you have a -- non-standard authentication technique. +-- +-- NOTE: THIS API IS EXPERIMENTAL AND SUBJECT TO CHANGE. data AuthProtect (tag :: k) deriving (Typeable)