From 53d3f6db80b731d0058b7657de8edf53d6404ef7 Mon Sep 17 00:00:00 2001 From: Christian Marie Date: Mon, 23 Feb 2015 09:54:07 +1100 Subject: [PATCH] Rename safeInfo to extraInfo --- example/greet.hs | 2 +- src/Servant/Docs.hs | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/example/greet.hs b/example/greet.hs index e5d448d1..c7815d51 100644 --- a/example/greet.hs +++ b/example/greet.hs @@ -88,7 +88,7 @@ testApi = Proxy -- notes. extra :: ExtraInfo TestApi extra = - safeInfo (Proxy :: Proxy ("greet" :> Capture "greetid" Text :> Delete)) $ + extraInfo (Proxy :: Proxy ("greet" :> Capture "greetid" Text :> Delete)) $ defAction & headers <>~ ["unicorns"] & notes <>~ [ DocNote "Title" ["This is some text"] , DocNote "Second secton" ["And some more"] diff --git a/src/Servant/Docs.hs b/src/Servant/Docs.hs index 2cd4a564..24b35cce 100644 --- a/src/Servant/Docs.hs +++ b/src/Servant/Docs.hs @@ -127,7 +127,7 @@ -- > -- notes. -- > extra :: ExtraInfo TestApi -- > extra = --- > safeInfo (Proxy :: Proxy ("greet" :> Capture "greetid" Text :> Delete)) $ +-- > extraInfo (Proxy :: Proxy ("greet" :> Capture "greetid" Text :> Delete)) $ -- > defAction & headers <>~ ["unicorns"] -- > & notes <>~ [ DocNote "Title" ["This is some text"] -- > , DocNote "Second secton" ["And some more"] @@ -149,7 +149,7 @@ module Servant.Docs ( -- * 'HasDocs' class and key functions HasDocs(..), docs, markdown -- * Generating docs with extra information - , ExtraInfo(..), docsWith, docsWithIntros, safeInfo + , ExtraInfo(..), docsWith, docsWithIntros, extraInfo , -- * Classes you need to implement for your types ToSample(..) @@ -317,7 +317,7 @@ data DocNote = DocNote -- | Type of extra information that a user may wish to "union" with their -- documentation. -- --- These are intended to be built using safeInfo. +-- These are intended to be built using extraInfo. -- Multiple ExtraInfo may be combined with the monoid instance. newtype ExtraInfo layout = ExtraInfo (HashMap Endpoint Action) instance Monoid (ExtraInfo a) where @@ -448,15 +448,15 @@ type family IsIn (endpoint :: *) (api :: *) :: Constraint where -- -- > extra :: ExtraInfo TestApi -- > extra = --- > safeInfo (Proxy :: Proxy ("greet" :> Capture "greetid" Text :> Delete)) $ +-- > extraInfo (Proxy :: Proxy ("greet" :> Capture "greetid" Text :> Delete)) $ -- > defAction & headers <>~ ["unicorns"] -- > & notes <>~ [ DocNote "Title" ["This is some text"] -- > , DocNote "Second secton" ["And some more"] -- > ] -safeInfo :: (IsIn endpoint layout, HasLink endpoint, HasDocs endpoint) +extraInfo :: (IsIn endpoint layout, HasLink endpoint, HasDocs endpoint) => Proxy endpoint -> Action -> ExtraInfo layout -safeInfo p action = +extraInfo p action = let api = docsFor p (defEndpoint, defAction) -- Assume one endpoint, HasLink constraint means that we should only ever -- point at one endpoint. @@ -471,7 +471,7 @@ safeInfo p action = -- will be "unioned" with the automatically generated endpoint documentation. -- -- You are expected to build up the ExtraInfo with the Monoid instance and --- 'safeInfo'. +-- 'extraInfo'. -- -- If you only want to add an introduction, use 'docsWithIntros'. docsWith :: HasDocs layout