git.iko.soy/typeable/servant
on master help sign in
Add HasLink instance for AuthProtect.
commit6dd473d9803a251baa886b30307e4f6772cea90e authorMikkel Christiansen <mikkel@rheosystems.com> dateMon 27 Mar 2017, 21:52 (10 years ago) parentb0dbd79
1 file changed+6
servant/src/Servant/Utils/Links.hs+6
servant/src/Servant/Utils/Links.hs+6
@@ -112,6 +112,7 @@ import Servant.API.Verbs ( Verb )
112112import Servant.API.Sub ( type (:>) )
113113import Servant.API.Raw ( Raw )
114114import Servant.API.TypeLevel
115+import Servant.API.Experimental.Auth ( AuthProtect )
115116
116117-- | A safe link datatype.
117118-- 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
259260instance HasLink Raw where
260261 type MkLink Raw = Link
261262 toLink _ = id
263+
264+-- AuthProtext instances
265+instance HasLink sub => HasLink (AuthProtect tag :> sub) where
266+ type MkLink (AuthProtect tag :> sub) = MkLink sub
267+ toLink _ = toLink (Proxy :: Proxy sub)