From 6dd473d9803a251baa886b30307e4f6772cea90e Mon Sep 17 00:00:00 2001 From: Mikkel Christiansen Date: Mon, 27 Mar 2017 21:52:29 +0200 Subject: [PATCH] Add HasLink instance for AuthProtect. --- servant/src/Servant/Utils/Links.hs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/servant/src/Servant/Utils/Links.hs b/servant/src/Servant/Utils/Links.hs index ee7090e1..ef1dadfa 100644 --- a/servant/src/Servant/Utils/Links.hs +++ b/servant/src/Servant/Utils/Links.hs @@ -112,6 +112,7 @@ import Servant.API.Verbs ( Verb ) import Servant.API.Sub ( type (:>) ) import Servant.API.Raw ( Raw ) import Servant.API.TypeLevel +import Servant.API.Experimental.Auth ( AuthProtect ) -- | A safe link datatype. -- The only way of constructing a 'Link' is using 'safeLink', which means any @@ -259,3 +260,8 @@ instance HasLink (Verb m s ct a) where instance HasLink Raw where type MkLink Raw = Link toLink _ = id + +-- AuthProtext instances +instance HasLink sub => HasLink (AuthProtect tag :> sub) where + type MkLink (AuthProtect tag :> sub) = MkLink sub + toLink _ = toLink (Proxy :: Proxy sub)