-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Helpers for generating clients for servant APIs in any programming language
--   
--   Helper types and functions for generating client functions for servant
--   APIs in any programming language
--   
--   This package provides types and functions that collect all the data
--   needed to generate client functions in the programming language of
--   your choice. This effectively means you only have to write the code
--   that "pretty-prints" this data as some code in your target language.
--   
--   See the servant-js package for an example
--   
--   <a>CHANGELOG</a>
@package servant-foreign
@version 0.15


-- | Generalizes all the data needed to make code generation work with
--   arbitrary programming languages.
module Servant.Foreign.Internal
newtype FunctionName
FunctionName :: [Text] -> FunctionName
[unFunctionName] :: FunctionName -> [Text]
_FunctionName :: Iso' FunctionName [Text]
newtype PathSegment
PathSegment :: Text -> PathSegment
[unPathSegment] :: PathSegment -> Text
_PathSegment :: Iso' PathSegment Text
data Arg f
Arg :: PathSegment -> f -> Arg f
[_argName] :: Arg f -> PathSegment
[_argType] :: Arg f -> f
argType :: forall f_ahXL f_alOg. Lens (Arg f_ahXL) (Arg f_alOg) f_ahXL f_alOg
argName :: forall f_ahXL. Lens' (Arg f_ahXL) PathSegment
argPath :: Getter (Arg f) Text
data SegmentType f

-- | a static path segment. like "/foo"
Static :: PathSegment -> SegmentType f

-- | a capture. like "/:userid"
Cap :: Arg f -> SegmentType f
_Cap :: forall f_alOv f_am3z. Prism (SegmentType f_am3z) (SegmentType f_alOv) (Arg f_am3z) (Arg f_alOv)
_Static :: forall f_alOv. Prism' (SegmentType f_alOv) PathSegment
newtype Segment f
Segment :: SegmentType f -> Segment f
[unSegment] :: Segment f -> SegmentType f
_Segment :: forall f_am3J f_amkP. Iso (Segment f_amkP) (Segment f_am3J) (SegmentType f_amkP) (SegmentType f_am3J)
isCapture :: Segment f -> Bool
captureArg :: Segment f -> Arg f
type Path f = [Segment f]
data ArgType
Normal :: ArgType
Flag :: ArgType
List :: ArgType
_List :: Prism' ArgType ()
_Flag :: Prism' ArgType ()
_Normal :: Prism' ArgType ()
data QueryArg f
QueryArg :: Arg f -> ArgType -> QueryArg f
[_queryArgName] :: QueryArg f -> Arg f
[_queryArgType] :: QueryArg f -> ArgType
queryArgType :: forall f_amsb. Lens' (QueryArg f_amsb) ArgType
queryArgName :: forall f_amsb f_amOX. Lens (QueryArg f_amsb) (QueryArg f_amOX) (Arg f_amsb) (Arg f_amOX)
data HeaderArg f
HeaderArg :: Arg f -> HeaderArg f
[_headerArg] :: HeaderArg f -> Arg f
ReplaceHeaderArg :: Arg f -> Text -> HeaderArg f
[_headerArg] :: HeaderArg f -> Arg f
[_headerPattern] :: HeaderArg f -> Text
headerPattern :: forall f_amPd. Traversal' (HeaderArg f_amPd) Text
headerArg :: forall f_amPd f_amY1. Lens (HeaderArg f_amPd) (HeaderArg f_amY1) (Arg f_amPd) (Arg f_amY1)
_ReplaceHeaderArg :: forall f_amPd. Prism' (HeaderArg f_amPd) (Arg f_amPd, Text)
_HeaderArg :: forall f_amPd. Prism' (HeaderArg f_amPd) (Arg f_amPd)
data Url f
Url :: Path f -> [QueryArg f] -> Url f
[_path] :: Url f -> Path f
[_queryStr] :: Url f -> [QueryArg f]
defUrl :: Url f
queryStr :: forall f_amZU. Lens' (Url f_amZU) [QueryArg f_amZU]
path :: forall f_amZU. Lens' (Url f_amZU) (Path f_amZU)
data ReqBodyContentType
ReqBodyJSON :: ReqBodyContentType
ReqBodyMultipart :: ReqBodyContentType
data Req f
Req :: Url f -> Method -> [HeaderArg f] -> Maybe f -> Maybe f -> FunctionName -> ReqBodyContentType -> Req f
[_reqUrl] :: Req f -> Url f
[_reqMethod] :: Req f -> Method
[_reqHeaders] :: Req f -> [HeaderArg f]
[_reqBody] :: Req f -> Maybe f
[_reqReturnType] :: Req f -> Maybe f
[_reqFuncName] :: Req f -> FunctionName
[_reqBodyContentType] :: Req f -> ReqBodyContentType
reqUrl :: forall f_an93. Lens' (Req f_an93) (Url f_an93)
reqReturnType :: forall f_an93. Lens' (Req f_an93) (Maybe f_an93)
reqMethod :: forall f_an93. Lens' (Req f_an93) Method
reqHeaders :: forall f_an93. Lens' (Req f_an93) [HeaderArg f_an93]
reqFuncName :: forall f_an93. Lens' (Req f_an93) FunctionName
reqBodyContentType :: forall f_an93. Lens' (Req f_an93) ReqBodyContentType
reqBody :: forall f_an93. Lens' (Req f_an93) (Maybe f_an93)
defReq :: Req ftype

-- | <a>HasForeignType</a> maps Haskell types with types in the target
--   language of your backend. For example, let's say you're implementing a
--   backend to some language <b>X</b>, and you want a Text representation
--   of each input/output type mentioned in the API:
--   
--   <pre>
--   -- First you need to create a dummy type to parametrize your
--   -- instances.
--   data LangX
--   
--   -- Otherwise you define instances for the types you need
--   instance HasForeignType LangX Text Int where
--      typeFor _ _ _ = "intX"
--   
--   -- Or for example in case of lists
--   instance HasForeignType LangX Text a =&gt; HasForeignType LangX Text [a] where
--      typeFor lang type _ = "listX of " &lt;&gt; typeFor lang ftype (Proxy :: Proxy a)
--   </pre>
--   
--   Finally to generate list of information about all the endpoints for an
--   API you create a function of a form:
--   
--   <pre>
--   getEndpoints :: (HasForeign LangX Text api, GenerateList Text (Foreign Text api))
--                =&gt; Proxy api -&gt; [Req Text]
--   getEndpoints api = listFromAPI (Proxy :: Proxy LangX) (Proxy :: Proxy Text) api
--   </pre>
--   
--   <pre>
--   -- If language __X__ is dynamically typed then you can use
--   -- a predefined NoTypes parameter with the NoContent output type:
--   </pre>
--   
--   <pre>
--   getEndpoints :: (HasForeign NoTypes NoContent api, GenerateList Text (Foreign NoContent api))
--                =&gt; Proxy api -&gt; [Req NoContent]
--   getEndpoints api = listFromAPI (Proxy :: Proxy NoTypes) (Proxy :: Proxy NoContent) api
--   </pre>
class HasForeignType lang ftype a
typeFor :: HasForeignType lang ftype a => Proxy lang -> Proxy ftype -> Proxy a -> ftype
data NoTypes
class HasForeign lang ftype (api :: *) where {
    type family Foreign ftype api :: *;
}
foreignFor :: HasForeign lang ftype api => Proxy lang -> Proxy ftype -> Proxy api -> Req ftype -> Foreign ftype api
data EmptyForeignAPI
EmptyForeignAPI :: EmptyForeignAPI

-- | Utility class used by <a>listFromAPI</a> which computes the data
--   needed to generate a function for each endpoint and hands it all back
--   in a list.
class GenerateList ftype reqs
generateList :: GenerateList ftype reqs => reqs -> [Req ftype]

-- | Generate the necessary data for codegen as a list, each <a>Req</a>
--   describing one endpoint from your API type.
listFromAPI :: (HasForeign lang ftype api, GenerateList ftype (Foreign ftype api)) => Proxy lang -> Proxy ftype -> Proxy api -> [Req ftype]
instance Servant.Foreign.Internal.GenerateList ftype Servant.Foreign.Internal.EmptyForeignAPI
instance Servant.Foreign.Internal.GenerateList ftype (Servant.Foreign.Internal.Req ftype)
instance (Servant.Foreign.Internal.GenerateList ftype start, Servant.Foreign.Internal.GenerateList ftype rest) => Servant.Foreign.Internal.GenerateList ftype (start Servant.API.Alternative.:<|> rest)
instance forall k (lang :: k) ftype. Servant.Foreign.Internal.HasForeign lang ftype Servant.API.Empty.EmptyAPI
instance forall k (lang :: k) ftype a b. (Servant.Foreign.Internal.HasForeign lang ftype a, Servant.Foreign.Internal.HasForeign lang ftype b) => Servant.Foreign.Internal.HasForeign lang ftype (a Servant.API.Alternative.:<|> b)
instance forall k (sym :: GHC.Types.Symbol) (lang :: k) ftype t api (mods :: [*]). (GHC.TypeLits.KnownSymbol sym, Servant.Foreign.Internal.HasForeignType lang ftype t, Servant.Foreign.Internal.HasForeign lang ftype api) => Servant.Foreign.Internal.HasForeign lang ftype (Servant.API.Capture.Capture' mods sym t Servant.API.Sub.:> api)
instance forall k (sym :: GHC.Types.Symbol) (lang :: k) ftype t sublayout. (GHC.TypeLits.KnownSymbol sym, Servant.Foreign.Internal.HasForeignType lang ftype [t], Servant.Foreign.Internal.HasForeign lang ftype sublayout) => Servant.Foreign.Internal.HasForeign lang ftype (Servant.API.Capture.CaptureAll sym t Servant.API.Sub.:> sublayout)
instance forall k k1 (list :: [*]) (lang :: k) ftype a (method :: k1) (status :: GHC.Types.Nat). (Servant.API.TypeLevel.Elem Servant.API.ContentTypes.JSON list, Servant.Foreign.Internal.HasForeignType lang ftype a, Servant.API.Verbs.ReflectMethod method) => Servant.Foreign.Internal.HasForeign lang ftype (Servant.API.Verbs.Verb method status list a)
instance forall k k1 ct (lang :: k) ftype a (method :: k1) (status :: GHC.Types.Nat) framing. (ct GHC.Types.~ Servant.API.ContentTypes.JSON, Servant.Foreign.Internal.HasForeignType lang ftype a, Servant.API.Verbs.ReflectMethod method) => Servant.Foreign.Internal.HasForeign lang ftype (Servant.API.Stream.Stream method status framing ct a)
instance forall k (sym :: GHC.Types.Symbol) (lang :: k) ftype (mods :: [*]) a api. (GHC.TypeLits.KnownSymbol sym, Servant.Foreign.Internal.HasForeignType lang ftype (Servant.API.Modifiers.RequiredArgument mods a), Servant.Foreign.Internal.HasForeign lang ftype api) => Servant.Foreign.Internal.HasForeign lang ftype (Servant.API.Header.Header' mods sym a Servant.API.Sub.:> api)
instance forall k (sym :: GHC.Types.Symbol) (lang :: k) ftype (mods :: [*]) a api. (GHC.TypeLits.KnownSymbol sym, Servant.Foreign.Internal.HasForeignType lang ftype (Servant.API.Modifiers.RequiredArgument mods a), Servant.Foreign.Internal.HasForeign lang ftype api) => Servant.Foreign.Internal.HasForeign lang ftype (Servant.API.QueryParam.QueryParam' mods sym a Servant.API.Sub.:> api)
instance forall k (sym :: GHC.Types.Symbol) (lang :: k) ftype a api. (GHC.TypeLits.KnownSymbol sym, Servant.Foreign.Internal.HasForeignType lang ftype [a], Servant.Foreign.Internal.HasForeign lang ftype api) => Servant.Foreign.Internal.HasForeign lang ftype (Servant.API.QueryParam.QueryParams sym a Servant.API.Sub.:> api)
instance forall k (sym :: GHC.Types.Symbol) (lang :: k) ftype api. (GHC.TypeLits.KnownSymbol sym, Servant.Foreign.Internal.HasForeignType lang ftype GHC.Types.Bool, Servant.Foreign.Internal.HasForeign lang ftype api) => Servant.Foreign.Internal.HasForeign lang ftype (Servant.API.QueryParam.QueryFlag sym Servant.API.Sub.:> api)
instance forall k (lang :: k) ftype. Servant.Foreign.Internal.HasForeign lang ftype Servant.API.Raw.Raw
instance forall k (list :: [*]) (lang :: k) ftype a api (mods :: [*]). (Servant.API.TypeLevel.Elem Servant.API.ContentTypes.JSON list, Servant.Foreign.Internal.HasForeignType lang ftype a, Servant.Foreign.Internal.HasForeign lang ftype api) => Servant.Foreign.Internal.HasForeign lang ftype (Servant.API.ReqBody.ReqBody' mods list a Servant.API.Sub.:> api)
instance forall k (lang :: k) ftype api (mods :: [*]) framing ctype a. Servant.Foreign.Internal.HasForeign lang ftype api => Servant.Foreign.Internal.HasForeign lang ftype (Servant.API.Stream.StreamBody' mods framing ctype a Servant.API.Sub.:> api)
instance forall k (path :: GHC.Types.Symbol) (lang :: k) ftype api. (GHC.TypeLits.KnownSymbol path, Servant.Foreign.Internal.HasForeign lang ftype api) => Servant.Foreign.Internal.HasForeign lang ftype (path Servant.API.Sub.:> api)
instance forall k (lang :: k) ftype api. Servant.Foreign.Internal.HasForeign lang ftype api => Servant.Foreign.Internal.HasForeign lang ftype (Servant.API.RemoteHost.RemoteHost Servant.API.Sub.:> api)
instance forall k (lang :: k) ftype api. Servant.Foreign.Internal.HasForeign lang ftype api => Servant.Foreign.Internal.HasForeign lang ftype (Servant.API.IsSecure.IsSecure Servant.API.Sub.:> api)
instance forall k (lang :: k) ftype api. Servant.Foreign.Internal.HasForeign lang ftype api => Servant.Foreign.Internal.HasForeign lang ftype (Data.Vault.Lazy.Vault Servant.API.Sub.:> api)
instance forall k (lang :: k) ftype api (name :: GHC.Types.Symbol) (context :: [*]). Servant.Foreign.Internal.HasForeign lang ftype api => Servant.Foreign.Internal.HasForeign lang ftype (Servant.API.WithNamedContext.WithNamedContext name context api)
instance forall k (lang :: k) ftype api. Servant.Foreign.Internal.HasForeign lang ftype api => Servant.Foreign.Internal.HasForeign lang ftype (Network.HTTP.Types.Version.HttpVersion Servant.API.Sub.:> api)
instance forall k (lang :: k) ftype api (desc :: GHC.Types.Symbol). Servant.Foreign.Internal.HasForeign lang ftype api => Servant.Foreign.Internal.HasForeign lang ftype (Servant.API.Description.Summary desc Servant.API.Sub.:> api)
instance forall k (lang :: k) ftype api (desc :: GHC.Types.Symbol). Servant.Foreign.Internal.HasForeign lang ftype api => Servant.Foreign.Internal.HasForeign lang ftype (Servant.API.Description.Description desc Servant.API.Sub.:> api)
instance forall k (ftype :: k). Servant.Foreign.Internal.HasForeignType Servant.Foreign.Internal.NoTypes Servant.API.ContentTypes.NoContent ftype
instance GHC.Show.Show f => GHC.Show.Show (Servant.Foreign.Internal.Req f)
instance GHC.Classes.Eq f => GHC.Classes.Eq (Servant.Foreign.Internal.Req f)
instance Data.Data.Data f => Data.Data.Data (Servant.Foreign.Internal.Req f)
instance GHC.Read.Read Servant.Foreign.Internal.ReqBodyContentType
instance GHC.Show.Show Servant.Foreign.Internal.ReqBodyContentType
instance GHC.Classes.Eq Servant.Foreign.Internal.ReqBodyContentType
instance Data.Data.Data Servant.Foreign.Internal.ReqBodyContentType
instance GHC.Show.Show f => GHC.Show.Show (Servant.Foreign.Internal.Url f)
instance GHC.Classes.Eq f => GHC.Classes.Eq (Servant.Foreign.Internal.Url f)
instance Data.Data.Data f => Data.Data.Data (Servant.Foreign.Internal.Url f)
instance GHC.Show.Show f => GHC.Show.Show (Servant.Foreign.Internal.HeaderArg f)
instance GHC.Classes.Eq f => GHC.Classes.Eq (Servant.Foreign.Internal.HeaderArg f)
instance Data.Data.Data f => Data.Data.Data (Servant.Foreign.Internal.HeaderArg f)
instance GHC.Show.Show f => GHC.Show.Show (Servant.Foreign.Internal.QueryArg f)
instance GHC.Classes.Eq f => GHC.Classes.Eq (Servant.Foreign.Internal.QueryArg f)
instance Data.Data.Data f => Data.Data.Data (Servant.Foreign.Internal.QueryArg f)
instance GHC.Show.Show Servant.Foreign.Internal.ArgType
instance GHC.Classes.Eq Servant.Foreign.Internal.ArgType
instance Data.Data.Data Servant.Foreign.Internal.ArgType
instance GHC.Show.Show f => GHC.Show.Show (Servant.Foreign.Internal.Segment f)
instance GHC.Classes.Eq f => GHC.Classes.Eq (Servant.Foreign.Internal.Segment f)
instance Data.Data.Data f => Data.Data.Data (Servant.Foreign.Internal.Segment f)
instance GHC.Show.Show f => GHC.Show.Show (Servant.Foreign.Internal.SegmentType f)
instance GHC.Classes.Eq f => GHC.Classes.Eq (Servant.Foreign.Internal.SegmentType f)
instance Data.Data.Data f => Data.Data.Data (Servant.Foreign.Internal.SegmentType f)
instance GHC.Show.Show f => GHC.Show.Show (Servant.Foreign.Internal.Arg f)
instance GHC.Classes.Eq f => GHC.Classes.Eq (Servant.Foreign.Internal.Arg f)
instance Data.Data.Data f => Data.Data.Data (Servant.Foreign.Internal.Arg f)
instance GHC.Base.Monoid Servant.Foreign.Internal.PathSegment
instance GHC.Base.Semigroup Servant.Foreign.Internal.PathSegment
instance Data.String.IsString Servant.Foreign.Internal.PathSegment
instance GHC.Classes.Eq Servant.Foreign.Internal.PathSegment
instance GHC.Show.Show Servant.Foreign.Internal.PathSegment
instance Data.Data.Data Servant.Foreign.Internal.PathSegment
instance GHC.Base.Monoid Servant.Foreign.Internal.FunctionName
instance GHC.Base.Semigroup Servant.Foreign.Internal.FunctionName
instance GHC.Classes.Eq Servant.Foreign.Internal.FunctionName
instance GHC.Show.Show Servant.Foreign.Internal.FunctionName
instance Data.Data.Data Servant.Foreign.Internal.FunctionName

module Servant.Foreign.Inflections

-- | Function name builder that simply concat each part together
concatCase :: FunctionName -> Text

-- | Function name builder using the snake_case convention. each part is
--   separated by a single underscore character.
snakeCase :: FunctionName -> Text

-- | Function name builder using the CamelCase convention. each part begins
--   with an upper case character.
camelCase :: FunctionName -> Text
concatCaseL :: Getter FunctionName Text
snakeCaseL :: Getter FunctionName Text
camelCaseL :: Getter FunctionName Text


-- | Generalizes all the data needed to make code generation work with
--   arbitrary programming languages.
module Servant.Foreign
data ArgType
Normal :: ArgType
Flag :: ArgType
List :: ArgType
data HeaderArg f
HeaderArg :: Arg f -> HeaderArg f
[_headerArg] :: HeaderArg f -> Arg f
ReplaceHeaderArg :: Arg f -> Text -> HeaderArg f
[_headerArg] :: HeaderArg f -> Arg f
[_headerPattern] :: HeaderArg f -> Text
data QueryArg f
QueryArg :: Arg f -> ArgType -> QueryArg f
[_queryArgName] :: QueryArg f -> Arg f
[_queryArgType] :: QueryArg f -> ArgType
data Req f
Req :: Url f -> Method -> [HeaderArg f] -> Maybe f -> Maybe f -> FunctionName -> ReqBodyContentType -> Req f
[_reqUrl] :: Req f -> Url f
[_reqMethod] :: Req f -> Method
[_reqHeaders] :: Req f -> [HeaderArg f]
[_reqBody] :: Req f -> Maybe f
[_reqReturnType] :: Req f -> Maybe f
[_reqFuncName] :: Req f -> FunctionName
[_reqBodyContentType] :: Req f -> ReqBodyContentType
data ReqBodyContentType
ReqBodyJSON :: ReqBodyContentType
ReqBodyMultipart :: ReqBodyContentType
newtype Segment f
Segment :: SegmentType f -> Segment f
[unSegment] :: Segment f -> SegmentType f
data SegmentType f

-- | a static path segment. like "/foo"
Static :: PathSegment -> SegmentType f

-- | a capture. like "/:userid"
Cap :: Arg f -> SegmentType f
data Url f
Url :: Path f -> [QueryArg f] -> Url f
[_path] :: Url f -> Path f
[_queryStr] :: Url f -> [QueryArg f]
type Path f = [Segment f]
data Arg f
Arg :: PathSegment -> f -> Arg f
[_argName] :: Arg f -> PathSegment
[_argType] :: Arg f -> f
newtype FunctionName
FunctionName :: [Text] -> FunctionName
[unFunctionName] :: FunctionName -> [Text]
newtype PathSegment
PathSegment :: Text -> PathSegment
[unPathSegment] :: PathSegment -> Text
argName :: forall f_ahXL. Lens' (Arg f_ahXL) PathSegment
argType :: forall f_ahXL f_alOg. Lens (Arg f_ahXL) (Arg f_alOg) f_ahXL f_alOg
argPath :: Getter (Arg f) Text
reqUrl :: forall f_an93. Lens' (Req f_an93) (Url f_an93)
reqMethod :: forall f_an93. Lens' (Req f_an93) Method
reqHeaders :: forall f_an93. Lens' (Req f_an93) [HeaderArg f_an93]
reqBody :: forall f_an93. Lens' (Req f_an93) (Maybe f_an93)
reqBodyContentType :: forall f_an93. Lens' (Req f_an93) ReqBodyContentType
reqReturnType :: forall f_an93. Lens' (Req f_an93) (Maybe f_an93)
reqFuncName :: forall f_an93. Lens' (Req f_an93) FunctionName
path :: forall f_amZU. Lens' (Url f_amZU) (Path f_amZU)
queryStr :: forall f_amZU. Lens' (Url f_amZU) [QueryArg f_amZU]
queryArgName :: forall f_amsb f_amOX. Lens (QueryArg f_amsb) (QueryArg f_amOX) (Arg f_amsb) (Arg f_amOX)
queryArgType :: forall f_amsb. Lens' (QueryArg f_amsb) ArgType
headerArg :: forall f_amPd f_amY1. Lens (HeaderArg f_amPd) (HeaderArg f_amY1) (Arg f_amPd) (Arg f_amY1)
_PathSegment :: Iso' PathSegment Text
_HeaderArg :: forall f_amPd. Prism' (HeaderArg f_amPd) (Arg f_amPd)
_ReplaceHeaderArg :: forall f_amPd. Prism' (HeaderArg f_amPd) (Arg f_amPd, Text)
_Static :: forall f_alOv. Prism' (SegmentType f_alOv) PathSegment
_Cap :: forall f_alOv f_am3z. Prism (SegmentType f_am3z) (SegmentType f_alOv) (Arg f_am3z) (Arg f_alOv)
_Normal :: Prism' ArgType ()
_Flag :: Prism' ArgType ()
_List :: Prism' ArgType ()
class HasForeign lang ftype (api :: *) where {
    type family Foreign ftype api :: *;
}
foreignFor :: HasForeign lang ftype api => Proxy lang -> Proxy ftype -> Proxy api -> Req ftype -> Foreign ftype api

-- | <a>HasForeignType</a> maps Haskell types with types in the target
--   language of your backend. For example, let's say you're implementing a
--   backend to some language <b>X</b>, and you want a Text representation
--   of each input/output type mentioned in the API:
--   
--   <pre>
--   -- First you need to create a dummy type to parametrize your
--   -- instances.
--   data LangX
--   
--   -- Otherwise you define instances for the types you need
--   instance HasForeignType LangX Text Int where
--      typeFor _ _ _ = "intX"
--   
--   -- Or for example in case of lists
--   instance HasForeignType LangX Text a =&gt; HasForeignType LangX Text [a] where
--      typeFor lang type _ = "listX of " &lt;&gt; typeFor lang ftype (Proxy :: Proxy a)
--   </pre>
--   
--   Finally to generate list of information about all the endpoints for an
--   API you create a function of a form:
--   
--   <pre>
--   getEndpoints :: (HasForeign LangX Text api, GenerateList Text (Foreign Text api))
--                =&gt; Proxy api -&gt; [Req Text]
--   getEndpoints api = listFromAPI (Proxy :: Proxy LangX) (Proxy :: Proxy Text) api
--   </pre>
--   
--   <pre>
--   -- If language __X__ is dynamically typed then you can use
--   -- a predefined NoTypes parameter with the NoContent output type:
--   </pre>
--   
--   <pre>
--   getEndpoints :: (HasForeign NoTypes NoContent api, GenerateList Text (Foreign NoContent api))
--                =&gt; Proxy api -&gt; [Req NoContent]
--   getEndpoints api = listFromAPI (Proxy :: Proxy NoTypes) (Proxy :: Proxy NoContent) api
--   </pre>
class HasForeignType lang ftype a
typeFor :: HasForeignType lang ftype a => Proxy lang -> Proxy ftype -> Proxy a -> ftype

-- | Utility class used by <a>listFromAPI</a> which computes the data
--   needed to generate a function for each endpoint and hands it all back
--   in a list.
class GenerateList ftype reqs
generateList :: GenerateList ftype reqs => reqs -> [Req ftype]
data NoTypes
captureArg :: Segment f -> Arg f
isCapture :: Segment f -> Bool
defReq :: Req ftype

-- | Generate the necessary data for codegen as a list, each <a>Req</a>
--   describing one endpoint from your API type.
listFromAPI :: (HasForeign lang ftype api, GenerateList ftype (Foreign ftype api)) => Proxy lang -> Proxy ftype -> Proxy api -> [Req ftype]
