Aelve Codesearch

grep over package repositories
Please provide a string to search for.
3+ characters are required.
Index updated about a month ago

total matches: 222

servant-docs-0.11.3
7 matches
src/Servant/Docs/Internal.hs
          status = fromInteger $ natVal (Proxy :: Proxy status)
          p = Proxy :: Proxy a

instance (KnownSymbol sym, HasDocs api)
      => HasDocs (Header' mods sym a :> api) where
  docsFor Proxy (endpoint, action) =
    docsFor subApiP (endpoint, action')

    where subApiP = Proxy :: Proxy api

            
src/Servant/Docs/Internal.hs
          action' = over headers (|> headername) action
          headername = T.pack $ symbolVal (Proxy :: Proxy sym)

instance (KnownSymbol sym, ToParam (QueryParam' mods sym a), HasDocs api)
      => HasDocs (QueryParam' mods sym a :> api) where

  docsFor Proxy (endpoint, action) =
    docsFor subApiP (endpoint, action')


            
src/Servant/Docs/Internal.hs
          paramP = Proxy :: Proxy (QueryParam' mods sym a)
          action' = over params (|> toParam paramP) action

instance (KnownSymbol sym, ToParam (QueryParams sym a), HasDocs api)
      => HasDocs (QueryParams sym a :> api) where

  docsFor Proxy (endpoint, action) =
    docsFor subApiP (endpoint, action')


            
src/Servant/Docs/Internal.hs
          action' = over params (|> toParam paramP) action


instance (KnownSymbol sym, ToParam (QueryFlag sym), HasDocs api)
      => HasDocs (QueryFlag sym :> api) where

  docsFor Proxy (endpoint, action) =
    docsFor subApiP (endpoint, action')


            
src/Servant/Docs/Internal.hs
    single endpoint action


instance (KnownSymbol desc, HasDocs api)
  => HasDocs (Description desc :> api) where

  docsFor Proxy (endpoint, action) =
    docsFor subApiP (endpoint, action')


            
src/Servant/Docs/Internal.hs
          action' = over notes (|> note) action
          note = DocNote (symbolVal (Proxy :: Proxy desc)) []

instance (KnownSymbol desc, HasDocs api)
  => HasDocs (Summary desc :> api) where

  docsFor Proxy (endpoint, action) =
    docsFor subApiP (endpoint, action')


            
src/Servant/Docs/Internal.hs

        t = Proxy :: Proxy ctype

instance (KnownSymbol path, HasDocs api) => HasDocs (path :> api) where

  docsFor Proxy (endpoint, action) =
    docsFor subApiP (endpoint', action)

    where subApiP = Proxy :: Proxy api

            
servant-github-0.1.0.6
2 matches
src/Network/GitHub/Types.hs

import Control.Monad
import GHC.Generics
import GHC.TypeLits (KnownSymbol, symbolVal, Symbol)

import Data.Aeson
import Data.Text
import qualified Data.Text as T (pack)
import Data.Time

            
src/Network/GitHub/Types.hs
    , items :: [a]
    }

instance (FromJSON a, KnownSymbol name) => FromJSON (CountedList name a) where
  parseJSON (Object o) =
    CountedList <$> o .: "total_count"
                <*> o .: T.pack (symbolVal (Proxy :: Proxy name))
  parseJSON _ = mzero


            
servant-github-webhook-0.4.1.0
1 matches
src/Servant/GitHub/Webhook.hs
class Reflect (a :: k) where
  reflect :: Proxy (a :: k) -> Demote a

instance KnownSymbol s => Reflect (s :: Symbol) where
  reflect = symbolVal

instance Reflect '() where
  reflect _ = ()


            
servant-server-0.16.1
9 matches
src/Servant/Server/Internal.hs
import qualified Data.Text                                  as T
import           Data.Typeable
import           GHC.TypeLits
                 (KnownNat, KnownSymbol, natVal, symbolVal)
import qualified Network.HTTP.Media                         as NHM
import           Network.HTTP.Types                         hiding
                 (Header, ResponseHeaders)
import           Network.Socket
                 (SockAddr)

            
src/Servant/Server/Internal.hs
-- > server = getBook
-- >   where getBook :: Text -> Handler Book
-- >         getBook isbn = ...
instance (KnownSymbol capture, FromHttpApiData a, HasServer api context)
      => HasServer (Capture' mods capture a :> api) context where

  type ServerT (Capture' mods capture a :> api) m =
     a -> ServerT api m


            
src/Servant/Server/Internal.hs
-- > server = getSourceFile
-- >   where getSourceFile :: [Text] -> Handler Book
-- >         getSourceFile pathSegments = ...
instance (KnownSymbol capture, FromHttpApiData a, HasServer api context)
      => HasServer (CaptureAll capture a :> api) context where

  type ServerT (CaptureAll capture a :> api) m =
    [a] -> ServerT api m


            
src/Servant/Server/Internal.hs
-- >   where viewReferer :: Referer -> Handler referer
-- >         viewReferer referer = return referer
instance
  (KnownSymbol sym, FromHttpApiData a, HasServer api context
  , SBoolI (FoldRequired mods), SBoolI (FoldLenient mods)
  )
  => HasServer (Header' mods sym a :> api) context where
------
  type ServerT (Header' mods sym a :> api) m =

            
src/Servant/Server/Internal.hs
-- >         getBooksBy Nothing       = ...return all books...
-- >         getBooksBy (Just author) = ...return books by the given author...
instance
  ( KnownSymbol sym, FromHttpApiData a, HasServer api context
  , SBoolI (FoldRequired mods), SBoolI (FoldLenient mods)
  )
  => HasServer (QueryParam' mods sym a :> api) context where
------
  type ServerT (QueryParam' mods sym a :> api) m =

            
src/Servant/Server/Internal.hs
-- > server = getBooksBy
-- >   where getBooksBy :: [Text] -> Handler [Book]
-- >         getBooksBy authors = ...return all books by these authors...
instance (KnownSymbol sym, FromHttpApiData a, HasServer api context)
      => HasServer (QueryParams sym a :> api) context where

  type ServerT (QueryParams sym a :> api) m =
    [a] -> ServerT api m


            
src/Servant/Server/Internal.hs
-- > server = getBooks
-- >   where getBooks :: Bool -> Handler [Book]
-- >         getBooks onlyPublished = ...return all books, or only the ones that are already published, depending on the argument...
instance (KnownSymbol sym, HasServer api context)
      => HasServer (QueryFlag sym :> api) context where

  type ServerT (QueryFlag sym :> api) m =
    Bool -> ServerT api m


            
src/Servant/Server/Internal.hs

-- | Make sure the incoming request starts with @"/path"@, strip it and
-- pass the rest of the request path to @api@.
instance (KnownSymbol path, HasServer api context) => HasServer (path :> api) context where

  type ServerT (path :> api) m = ServerT api m

  route Proxy context subserver =
    pathRouter

            
src/Servant/Server/Internal.hs
  hoistServerWithContext _ _ _ = retag

-- | Basic Authentication
instance ( KnownSymbol realm
         , HasServer api context
         , HasContextEntry context (BasicAuthCheck usr)
         )
    => HasServer (BasicAuth realm usr :> api) context where


            
servant-snap-0.8.4.1
7 matches
src/Servant/Server/Internal.hs
import           Data.Text                   (Text)
import           Data.Typeable               (Typeable)
import           GHC.Generics
import           GHC.TypeLits                (KnownNat, KnownSymbol, natVal,
                                              symbolVal)
import           Network.HTTP.Types          (HeaderName, Method,
                                              Status(..), parseQueryText,
                                              methodGet, methodHead,
                                              hContentType, hAccept)

            
src/Servant/Server/Internal.hs
-- > server = viewReferer
-- >   where viewReferer :: Referer -> EitherT ServantErr IO referer
-- >         viewReferer referer = return referer
instance (KnownSymbol sym, FromHttpApiData a, HasServer api context m
         , SBoolI (FoldRequired mods), SBoolI (FoldLenient mods)
         )
      => HasServer (Header' mods sym a :> api) context m where

  type ServerT (Header' mods sym a :> api) context m =

            
src/Servant/Server/Internal.hs
-- >   where getBooksBy :: Maybe Text -> EitherT ServantErr IO [Book]
-- >         getBooksBy Nothing       = ...return all books...
-- >         getBooksBy (Just author) = ...return books by the given author...
instance (KnownSymbol sym, FromHttpApiData a, HasServer api context m
         , SBoolI (FoldRequired mods), SBoolI (FoldLenient mods)
         )
      => HasServer (QueryParam' mods sym a :> api) context m where

  type ServerT (QueryParam' mods sym a :> api) context m =

            
src/Servant/Server/Internal.hs
-- > server = getBooksBy
-- >   where getBooksBy :: [Text] -> EitherT ServantErr IO [Book]
-- >         getBooksBy authors = ...return all books by these authors...
instance (KnownSymbol sym, FromHttpApiData a, HasServer api context m)
      => HasServer (QueryParams sym a :> api) context m where

  type ServerT (QueryParams sym a :> api) context m =
    [a] -> ServerT api context m


            
src/Servant/Server/Internal.hs
-- > server = getBooks
-- >   where getBooks :: Bool -> EitherT ServantErr IO [Book]
-- >         getBooks onlyPublished = ...return all books, or only the ones that are already published, depending on the argument...
instance (KnownSymbol sym, HasServer api context m)
      => HasServer (QueryFlag sym :> api) context m where

  type ServerT (QueryFlag sym :> api) context m =
    Bool -> ServerT api context m


            
src/Servant/Server/Internal.hs

-- | Make sure the incoming request starts with @"/path"@, strip it and
-- pass the rest of the request path to @api@.
instance (KnownSymbol path, HasServer api context m) => HasServer (path :> api) context m where

  type ServerT (path :> api) context m = ServerT api context m

  route Proxy context subserver =
    pathRouter

            
src/Servant/Server/Internal.hs
  hoistServerWithContext _ _ _ = retag

-- | Basic Authentication
instance ( KnownSymbol realm
         , HasServer api context m
         , HasContextEntry context (BasicAuthCheck m usr)
         )
    => HasServer (BasicAuth realm usr :> api) context m where


            
servant-zeppelin-client-0.1.0.3
1 matches
src/Servant/Zeppelin/Client.hs
  parseJSON _ = fail "Nil dependency list should be the empty object."

instance ( FromJSON (DependencyList Identity ds ds)
         , KnownSymbol (NamedDependency d)
         , FromJSON d
         ) => FromJSON (DependencyList Identity (d : ds) (d : ds)) where
  parseJSON o@(Object v) = do
    d <- v .: (T.pack . symbolVal $ Proxy @(NamedDependency d))
    ds <- parseJSON o

            
smsaero-0.7.1
2 matches
src/SMSAero/API.hs
import Text.Read (readEither)

import Control.Applicative
import GHC.TypeLits (Symbol, KnownSymbol)

import Servant.API
import Servant.Client
import Servant.Docs
import Servant.Docs.Internal (_params)

            
src/SMSAero/API.hs
-- | Like 'QueryParam', but always required.
data RequiredQueryParam (sym :: Symbol) a

instance (HasClient sub, KnownSymbol sym, ToHttpApiData a) => HasClient (RequiredQueryParam sym a :> sub) where
  type Client (RequiredQueryParam sym a :> sub) = a -> Client sub
  clientWithRoute _ req param = clientWithRoute (Proxy :: Proxy (QueryParam sym a :> sub)) req (Just param)

instance (KnownSymbol sym, ToParam (QueryParam sym a), HasDocs sub) => HasDocs (RequiredQueryParam sym a :> sub) where
  docsFor _ (endpoint, action) =
    docsFor subP (endpoint, action')

    where subP = Proxy :: Proxy sub
          paramP = Proxy :: Proxy (QueryParam sym a)

            
solga-0.1.0.2
1 matches
src/Solga.hs
type seg /> g = Seg seg :> g
infixr 2 />

instance (KnownSymbol seg, Router next) => Router (Seg seg next) where
  tryRoute req = case Wai.pathInfo req of
    s : segs | Text.unpack s == symbolVal (Proxy :: Proxy seg) ->
      tryRouteNext segNext req { Wai.pathInfo = segs }
    _ -> Nothing