on master help sign in
Merge pull request #720 from mschristiansen/master

Add HasLink instance for AuthProtect.

commitf05b394261126d305047d12dac280050394aa14f authorAlp Mestanogullari <alpmestan@gmail.com> dateTue 28 Mar 2017, 11:53 (10 years ago) parentb0dbd796dd473d
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)