ocaml-export-0.13.0: Convert Haskell types in OCaml types

CopyrightPlow Technologies 2017
LicenseBSD3
Maintainermchaver@gmail.com
Stabilityexperimental
Safe HaskellNone
LanguageHaskell2010

OCaml.Export

Description

 
Synopsis

Documentation

data OCamlPackage (packageName :: Symbol) (packageDependencies :: [*]) Source #

Instances
(HasOCamlTypeMetaData (OCamlPackage packageName deps), HasOCamlTypeMetaData rest) => HasOCamlTypeMetaData (OCamlPackage packageName deps :<|> rest :: Type) Source #

packages

Instance details

Defined in OCaml.BuckleScript.Internal.Package

(HasOCamlTypeMetaData deps, HasOCamlTypeMetaData modules) => HasOCamlTypeMetaData (OCamlPackage packageName deps :> modules :: Type) Source #

build a packages dependencies and its declared modules

Instance details

Defined in OCaml.BuckleScript.Internal.Package

(HasOCamlTypeMetaData deps, HasOCamlTypeMetaData a, HasOCamlPackage' a) => HasOCamlPackage (OCamlPackage packageName deps :> a :: Type) Source # 
Instance details

Defined in OCaml.BuckleScript.Internal.Package

Methods

mkPackage :: Proxy (OCamlPackage packageName deps :> a) -> PackageOptions -> IO () Source #

type NoDependency = '[] Source #

data OCamlModule (modules :: [Symbol]) Source #

An OCamlModule as a Haskell type. File level modules is relative to a root directory prvoiided in the mkPackage function.

Instances
(SingI modules, HasOCamlTypeMetaData' api) => HasOCamlTypeMetaData (OCamlModule modules :> api :: Type) Source #

single module

Instance details

Defined in OCaml.BuckleScript.Internal.Package

(SingI modules, HasOCamlModule' api) => HasOCamlModule (OCamlModule modules :> api :: Type) Source # 
Instance details

Defined in OCaml.BuckleScript.Internal.Package

data OCamlSubModule (subModules :: Symbol) Source #

Symobl will be expaneded to "module SymbolName = struct ... end".

data OCamlTypeInFile a (filePath :: Symbol) Source #

A handwritten OCaml type, encoder and decoder from a file.

data HaskellTypeName (name :: Symbol) a Source #

In case Generic is not derived, manually provide the type name user is responsible for making sure it is correct. otherwise it may lead to a compile error.

data PackageOptions Source #

Options for creating an OCaml package based on Haskell types.

Constructors

PackageOptions 

Fields

data SpecOptions Source #

Details for OCaml spec.

Constructors

SpecOptions 

Fields

mkFiles :: HasEmbeddedFile api => Bool -> Bool -> Proxy api -> Q Exp Source #

class OCamlType a where Source #

Create an OCaml type from a Haskell type. Use the Generic definition when possible. It also expects ToJSON and FromJSON to be derived generically.

Minimal complete definition

Nothing

Methods

toOCamlType :: a -> OCamlDatatype Source #

toOCamlType :: (Generic a, GenericOCamlDatatype (Rep a)) => a -> OCamlDatatype Source #

Instances
OCamlType Bool Source # 
Instance details

Defined in OCaml.BuckleScript.Types

OCamlType Char Source # 
Instance details

Defined in OCaml.BuckleScript.Types

OCamlType Double Source # 
Instance details

Defined in OCaml.BuckleScript.Types

OCamlType Float Source # 
Instance details

Defined in OCaml.BuckleScript.Types

OCamlType Int Source # 
Instance details

Defined in OCaml.BuckleScript.Types

OCamlType Int8 Source # 
Instance details

Defined in OCaml.BuckleScript.Types

OCamlType Int16 Source # 
Instance details

Defined in OCaml.BuckleScript.Types

OCamlType Int32 Source # 
Instance details

Defined in OCaml.BuckleScript.Types

OCamlType Int64 Source # 
Instance details

Defined in OCaml.BuckleScript.Types

OCamlType Integer Source # 
Instance details

Defined in OCaml.BuckleScript.Types

OCamlType Word Source # 
Instance details

Defined in OCaml.BuckleScript.Types

OCamlType Word8 Source # 
Instance details

Defined in OCaml.BuckleScript.Types

OCamlType Word16 Source # 
Instance details

Defined in OCaml.BuckleScript.Types

OCamlType Word32 Source # 
Instance details

Defined in OCaml.BuckleScript.Types

OCamlType Word64 Source # 
Instance details

Defined in OCaml.BuckleScript.Types

OCamlType () Source # 
Instance details

Defined in OCaml.BuckleScript.Types

OCamlType ByteString Source # 
Instance details

Defined in OCaml.BuckleScript.Types

OCamlType Text Source # 
Instance details

Defined in OCaml.BuckleScript.Types

OCamlType UTCTime Source # 
Instance details

Defined in OCaml.BuckleScript.Types

OCamlType Day Source # 
Instance details

Defined in OCaml.BuckleScript.Types

OCamlType TypeParameterRef5 Source # 
Instance details

Defined in OCaml.BuckleScript.Types

OCamlType TypeParameterRef4 Source # 
Instance details

Defined in OCaml.BuckleScript.Types

OCamlType TypeParameterRef3 Source # 
Instance details

Defined in OCaml.BuckleScript.Types

OCamlType TypeParameterRef2 Source # 
Instance details

Defined in OCaml.BuckleScript.Types

OCamlType TypeParameterRef1 Source # 
Instance details

Defined in OCaml.BuckleScript.Types

OCamlType TypeParameterRef0 Source # 
Instance details

Defined in OCaml.BuckleScript.Types

OCamlType a => OCamlType [a] Source # 
Instance details

Defined in OCaml.BuckleScript.Types

OCamlType a => OCamlType (Maybe a) Source # 
Instance details

Defined in OCaml.BuckleScript.Types

(OCamlType l, OCamlType r) => OCamlType (Either l r) Source # 
Instance details

Defined in OCaml.BuckleScript.Types

(OCamlType a, OCamlType b) => OCamlType (a, b) Source # 
Instance details

Defined in OCaml.BuckleScript.Types

Methods

toOCamlType :: (a, b) -> OCamlDatatype Source #

OCamlType a => OCamlType (Proxy a) Source # 
Instance details

Defined in OCaml.BuckleScript.Types

(OCamlType a, OCamlType b, OCamlType c) => OCamlType (a, b, c) Source # 
Instance details

Defined in OCaml.BuckleScript.Types

Methods

toOCamlType :: (a, b, c) -> OCamlDatatype Source #

(OCamlType a, OCamlType b, OCamlType c, OCamlType d) => OCamlType (a, b, c, d) Source # 
Instance details

Defined in OCaml.BuckleScript.Types

Methods

toOCamlType :: (a, b, c, d) -> OCamlDatatype Source #

(OCamlType a, OCamlType b, OCamlType c, OCamlType d, OCamlType e) => OCamlType (a, b, c, d, e) Source # 
Instance details

Defined in OCaml.BuckleScript.Types

Methods

toOCamlType :: (a, b, c, d, e) -> OCamlDatatype Source #

(OCamlType a, OCamlType b, OCamlType c, OCamlType d, OCamlType e, OCamlType f) => OCamlType (a, b, c, d, e, f) Source # 
Instance details

Defined in OCaml.BuckleScript.Types

Methods

toOCamlType :: (a, b, c, d, e, f) -> OCamlDatatype Source #

typeableToOCamlType :: forall a. Typeable a => Proxy a -> OCamlDatatype Source #

for any type that does not use the same serialization as Generic Aeson and has a manually written OCaml definition, should manually derive OCamlType using this function for convenience.

instance OCamlType X where toOCamlType _ = typeableToOCamlType (Proxy :: Proxy X)

newtype TypeParameterRef0 Source #

Used to fill the type parameters of proxy types. `Proxy :: Proxy (Maybe TypeParameterRef0)`, `Proxy :: Proxy Either TypeParameterRef0 TypeParameterRef1`. JSON representation is as an Int to simplify the automated tests.

Constructors

TypeParameterRef0 Int 
Instances
Eq TypeParameterRef0 Source # 
Instance details

Defined in OCaml.BuckleScript.Types

Read TypeParameterRef0 Source # 
Instance details

Defined in OCaml.BuckleScript.Types

Show TypeParameterRef0 Source # 
Instance details

Defined in OCaml.BuckleScript.Types

Generic TypeParameterRef0 Source # 
Instance details

Defined in OCaml.BuckleScript.Types

Associated Types

type Rep TypeParameterRef0 :: Type -> Type #

Arbitrary TypeParameterRef0 Source # 
Instance details

Defined in OCaml.BuckleScript.Types

ToJSON TypeParameterRef0 Source # 
Instance details

Defined in OCaml.BuckleScript.Types

FromJSON TypeParameterRef0 Source # 
Instance details

Defined in OCaml.BuckleScript.Types

ToADTArbitrary TypeParameterRef0 Source # 
Instance details

Defined in OCaml.BuckleScript.Types

OCamlType TypeParameterRef0 Source # 
Instance details

Defined in OCaml.BuckleScript.Types

type Rep TypeParameterRef0 Source # 
Instance details

Defined in OCaml.BuckleScript.Types

type Rep TypeParameterRef0 = D1 (MetaData "TypeParameterRef0" "OCaml.BuckleScript.Types" "ocaml-export-0.13.0-FgnypFfzJXvE8go9rtnKhY" True) (C1 (MetaCons "TypeParameterRef0" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Int)))

newtype TypeParameterRef1 Source #

Second unique TypeParameterRef.

Constructors

TypeParameterRef1 Int 
Instances
Eq TypeParameterRef1 Source # 
Instance details

Defined in OCaml.BuckleScript.Types

Read TypeParameterRef1 Source # 
Instance details

Defined in OCaml.BuckleScript.Types

Show TypeParameterRef1 Source # 
Instance details

Defined in OCaml.BuckleScript.Types

Generic TypeParameterRef1 Source # 
Instance details

Defined in OCaml.BuckleScript.Types

Associated Types

type Rep TypeParameterRef1 :: Type -> Type #

Arbitrary TypeParameterRef1 Source # 
Instance details

Defined in OCaml.BuckleScript.Types

ToJSON TypeParameterRef1 Source # 
Instance details

Defined in OCaml.BuckleScript.Types

FromJSON TypeParameterRef1 Source # 
Instance details

Defined in OCaml.BuckleScript.Types

ToADTArbitrary TypeParameterRef1 Source # 
Instance details

Defined in OCaml.BuckleScript.Types

OCamlType TypeParameterRef1 Source # 
Instance details

Defined in OCaml.BuckleScript.Types

type Rep TypeParameterRef1 Source # 
Instance details

Defined in OCaml.BuckleScript.Types

type Rep TypeParameterRef1 = D1 (MetaData "TypeParameterRef1" "OCaml.BuckleScript.Types" "ocaml-export-0.13.0-FgnypFfzJXvE8go9rtnKhY" True) (C1 (MetaCons "TypeParameterRef1" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Int)))

data TypeParameterRef2 Source #

Third unique TypeParameterRef.

Constructors

TypeParameterRef2 Int 
Instances
Eq TypeParameterRef2 Source # 
Instance details

Defined in OCaml.BuckleScript.Types

Read TypeParameterRef2 Source # 
Instance details

Defined in OCaml.BuckleScript.Types

Show TypeParameterRef2 Source # 
Instance details

Defined in OCaml.BuckleScript.Types

Generic TypeParameterRef2 Source # 
Instance details

Defined in OCaml.BuckleScript.Types

Associated Types

type Rep TypeParameterRef2 :: Type -> Type #

Arbitrary TypeParameterRef2 Source # 
Instance details

Defined in OCaml.BuckleScript.Types

ToJSON TypeParameterRef2 Source # 
Instance details

Defined in OCaml.BuckleScript.Types

FromJSON TypeParameterRef2 Source # 
Instance details

Defined in OCaml.BuckleScript.Types

ToADTArbitrary TypeParameterRef2 Source # 
Instance details

Defined in OCaml.BuckleScript.Types

OCamlType TypeParameterRef2 Source # 
Instance details

Defined in OCaml.BuckleScript.Types

type Rep TypeParameterRef2 Source # 
Instance details

Defined in OCaml.BuckleScript.Types

type Rep TypeParameterRef2 = D1 (MetaData "TypeParameterRef2" "OCaml.BuckleScript.Types" "ocaml-export-0.13.0-FgnypFfzJXvE8go9rtnKhY" False) (C1 (MetaCons "TypeParameterRef2" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Int)))

data TypeParameterRef3 Source #

Fourth unique TypeParameterRef.

Constructors

TypeParameterRef3 Int 
Instances
Eq TypeParameterRef3 Source # 
Instance details

Defined in OCaml.BuckleScript.Types

Read TypeParameterRef3 Source # 
Instance details

Defined in OCaml.BuckleScript.Types

Show TypeParameterRef3 Source # 
Instance details

Defined in OCaml.BuckleScript.Types

Generic TypeParameterRef3 Source # 
Instance details

Defined in OCaml.BuckleScript.Types

Associated Types

type Rep TypeParameterRef3 :: Type -> Type #

Arbitrary TypeParameterRef3 Source # 
Instance details

Defined in OCaml.BuckleScript.Types

ToJSON TypeParameterRef3 Source # 
Instance details

Defined in OCaml.BuckleScript.Types

FromJSON TypeParameterRef3 Source # 
Instance details

Defined in OCaml.BuckleScript.Types

ToADTArbitrary TypeParameterRef3 Source # 
Instance details

Defined in OCaml.BuckleScript.Types

OCamlType TypeParameterRef3 Source # 
Instance details

Defined in OCaml.BuckleScript.Types

type Rep TypeParameterRef3 Source # 
Instance details

Defined in OCaml.BuckleScript.Types

type Rep TypeParameterRef3 = D1 (MetaData "TypeParameterRef3" "OCaml.BuckleScript.Types" "ocaml-export-0.13.0-FgnypFfzJXvE8go9rtnKhY" False) (C1 (MetaCons "TypeParameterRef3" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Int)))

data TypeParameterRef4 Source #

Fifth unique TypeParameterRef.

Constructors

TypeParameterRef4 Int 
Instances
Eq TypeParameterRef4 Source # 
Instance details

Defined in OCaml.BuckleScript.Types

Read TypeParameterRef4 Source # 
Instance details

Defined in OCaml.BuckleScript.Types

Show TypeParameterRef4 Source # 
Instance details

Defined in OCaml.BuckleScript.Types

Generic TypeParameterRef4 Source # 
Instance details

Defined in OCaml.BuckleScript.Types

Associated Types

type Rep TypeParameterRef4 :: Type -> Type #

Arbitrary TypeParameterRef4 Source # 
Instance details

Defined in OCaml.BuckleScript.Types

ToJSON TypeParameterRef4 Source # 
Instance details

Defined in OCaml.BuckleScript.Types

FromJSON TypeParameterRef4 Source # 
Instance details

Defined in OCaml.BuckleScript.Types

ToADTArbitrary TypeParameterRef4 Source # 
Instance details

Defined in OCaml.BuckleScript.Types

OCamlType TypeParameterRef4 Source # 
Instance details

Defined in OCaml.BuckleScript.Types

type Rep TypeParameterRef4 Source # 
Instance details

Defined in OCaml.BuckleScript.Types

type Rep TypeParameterRef4 = D1 (MetaData "TypeParameterRef4" "OCaml.BuckleScript.Types" "ocaml-export-0.13.0-FgnypFfzJXvE8go9rtnKhY" False) (C1 (MetaCons "TypeParameterRef4" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Int)))

data TypeParameterRef5 Source #

Sixth unique TypeParameterRef.

Constructors

TypeParameterRef5 Int 
Instances
Eq TypeParameterRef5 Source # 
Instance details

Defined in OCaml.BuckleScript.Types

Read TypeParameterRef5 Source # 
Instance details

Defined in OCaml.BuckleScript.Types

Show TypeParameterRef5 Source # 
Instance details

Defined in OCaml.BuckleScript.Types

Generic TypeParameterRef5 Source # 
Instance details

Defined in OCaml.BuckleScript.Types

Associated Types

type Rep TypeParameterRef5 :: Type -> Type #

Arbitrary TypeParameterRef5 Source # 
Instance details

Defined in OCaml.BuckleScript.Types

ToJSON TypeParameterRef5 Source # 
Instance details

Defined in OCaml.BuckleScript.Types

FromJSON TypeParameterRef5 Source # 
Instance details

Defined in OCaml.BuckleScript.Types

ToADTArbitrary TypeParameterRef5 Source # 
Instance details

Defined in OCaml.BuckleScript.Types

OCamlType TypeParameterRef5 Source # 
Instance details

Defined in OCaml.BuckleScript.Types

type Rep TypeParameterRef5 Source # 
Instance details

Defined in OCaml.BuckleScript.Types

type Rep TypeParameterRef5 = D1 (MetaData "TypeParameterRef5" "OCaml.BuckleScript.Types" "ocaml-export-0.13.0-FgnypFfzJXvE8go9rtnKhY" False) (C1 (MetaCons "TypeParameterRef5" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Int)))

mkOCamlSpecServer :: forall ocamlPackage. OCamlPackageTypeCount ocamlPackage => String -> Proxy ocamlPackage -> Q [Dec] Source #

type family MkOCamlSpecAPI a :: * where ... Source #

Convert an OCamlPackage into a servant API.

Equations

MkOCamlSpecAPI (OCamlPackage a deps :> rest) = MkOCamlSpecAPI rest 
MkOCamlSpecAPI ((OCamlModule modules :> api) :<|> rest) = MkOCamlSpecAPI' modules '[] api :<|> MkOCamlSpecAPI rest 
MkOCamlSpecAPI (OCamlModule modules :> api) = MkOCamlSpecAPI' modules '[] api 

mkGoldenFiles :: HasMkGoldenFiles a => Proxy a -> Int -> FilePath -> IO () Source #

runGoldenSpec :: HasRunGoldenSpec a => Proxy a -> Int -> FilePath -> Spec Source #

data Proxy (t :: k) :: forall k. k -> Type #

Proxy is a type that holds no data, but has a phantom parameter of arbitrary type (or even kind). Its use is to provide type information, even though there is no value available of that type (or it may be too costly to create one).

Historically, Proxy :: Proxy a is a safer alternative to the 'undefined :: a' idiom.

>>> Proxy :: Proxy (Void, Int -> Int)
Proxy

Proxy can even hold types of higher kinds,

>>> Proxy :: Proxy Either
Proxy
>>> Proxy :: Proxy Functor
Proxy
>>> Proxy :: Proxy complicatedStructure
Proxy

Constructors

Proxy 
Instances
Generic1 (Proxy :: k -> Type) 
Instance details

Defined in GHC.Generics

Associated Types

type Rep1 Proxy :: k -> Type #

Methods

from1 :: Proxy a -> Rep1 Proxy a #

to1 :: Rep1 Proxy a -> Proxy a #

Monad (Proxy :: Type -> Type)

Since: base-4.7.0.0

Instance details

Defined in Data.Proxy

Methods

(>>=) :: Proxy a -> (a -> Proxy b) -> Proxy b #

(>>) :: Proxy a -> Proxy b -> Proxy b #

return :: a -> Proxy a #

fail :: String -> Proxy a #

Functor (Proxy :: Type -> Type)

Since: base-4.7.0.0

Instance details

Defined in Data.Proxy

Methods

fmap :: (a -> b) -> Proxy a -> Proxy b #

(<$) :: a -> Proxy b -> Proxy a #

Applicative (Proxy :: Type -> Type)

Since: base-4.7.0.0

Instance details

Defined in Data.Proxy

Methods

pure :: a -> Proxy a #

(<*>) :: Proxy (a -> b) -> Proxy a -> Proxy b #

liftA2 :: (a -> b -> c) -> Proxy a -> Proxy b -> Proxy c #

(*>) :: Proxy a -> Proxy b -> Proxy b #

(<*) :: Proxy a -> Proxy b -> Proxy a #

Foldable (Proxy :: Type -> Type)

Since: base-4.7.0.0

Instance details

Defined in Data.Foldable

Methods

fold :: Monoid m => Proxy m -> m #

foldMap :: Monoid m => (a -> m) -> Proxy a -> m #

foldr :: (a -> b -> b) -> b -> Proxy a -> b #

foldr' :: (a -> b -> b) -> b -> Proxy a -> b #

foldl :: (b -> a -> b) -> b -> Proxy a -> b #

foldl' :: (b -> a -> b) -> b -> Proxy a -> b #

foldr1 :: (a -> a -> a) -> Proxy a -> a #

foldl1 :: (a -> a -> a) -> Proxy a -> a #

toList :: Proxy a -> [a] #

null :: Proxy a -> Bool #

length :: Proxy a -> Int #

elem :: Eq a => a -> Proxy a -> Bool #

maximum :: Ord a => Proxy a -> a #

minimum :: Ord a => Proxy a -> a #

sum :: Num a => Proxy a -> a #

product :: Num a => Proxy a -> a #

Traversable (Proxy :: Type -> Type)

Since: base-4.7.0.0

Instance details

Defined in Data.Traversable

Methods

traverse :: Applicative f => (a -> f b) -> Proxy a -> f (Proxy b) #

sequenceA :: Applicative f => Proxy (f a) -> f (Proxy a) #

mapM :: Monad m => (a -> m b) -> Proxy a -> m (Proxy b) #

sequence :: Monad m => Proxy (m a) -> m (Proxy a) #

ToJSON1 (Proxy :: Type -> Type) 
Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON :: (a -> Value) -> ([a] -> Value) -> Proxy a -> Value #

liftToJSONList :: (a -> Value) -> ([a] -> Value) -> [Proxy a] -> Value #

liftToEncoding :: (a -> Encoding) -> ([a] -> Encoding) -> Proxy a -> Encoding #

liftToEncodingList :: (a -> Encoding) -> ([a] -> Encoding) -> [Proxy a] -> Encoding #

FromJSON1 (Proxy :: Type -> Type) 
Instance details

Defined in Data.Aeson.Types.FromJSON

Methods

liftParseJSON :: (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser (Proxy a) #

liftParseJSONList :: (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser [Proxy a] #

Alternative (Proxy :: Type -> Type)

Since: base-4.9.0.0

Instance details

Defined in Data.Proxy

Methods

empty :: Proxy a #

(<|>) :: Proxy a -> Proxy a -> Proxy a #

some :: Proxy a -> Proxy [a] #

many :: Proxy a -> Proxy [a] #

MonadPlus (Proxy :: Type -> Type)

Since: base-4.9.0.0

Instance details

Defined in Data.Proxy

Methods

mzero :: Proxy a #

mplus :: Proxy a -> Proxy a -> Proxy a #

Eq1 (Proxy :: Type -> Type)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Classes

Methods

liftEq :: (a -> b -> Bool) -> Proxy a -> Proxy b -> Bool #

Ord1 (Proxy :: Type -> Type)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Classes

Methods

liftCompare :: (a -> b -> Ordering) -> Proxy a -> Proxy b -> Ordering #

Read1 (Proxy :: Type -> Type)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Classes

Methods

liftReadsPrec :: (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (Proxy a) #

liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [Proxy a] #

liftReadPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec (Proxy a) #

liftReadListPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec [Proxy a] #

Show1 (Proxy :: Type -> Type)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Classes

Methods

liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> Proxy a -> ShowS #

liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [Proxy a] -> ShowS #

Hashable1 (Proxy :: Type -> Type) 
Instance details

Defined in Data.Hashable.Class

Methods

liftHashWithSalt :: (Int -> a -> Int) -> Int -> Proxy a -> Int #

Bounded (Proxy t)

Since: base-4.7.0.0

Instance details

Defined in Data.Proxy

Methods

minBound :: Proxy t #

maxBound :: Proxy t #

Enum (Proxy s)

Since: base-4.7.0.0

Instance details

Defined in Data.Proxy

Methods

succ :: Proxy s -> Proxy s #

pred :: Proxy s -> Proxy s #

toEnum :: Int -> Proxy s #

fromEnum :: Proxy s -> Int #

enumFrom :: Proxy s -> [Proxy s] #

enumFromThen :: Proxy s -> Proxy s -> [Proxy s] #

enumFromTo :: Proxy s -> Proxy s -> [Proxy s] #

enumFromThenTo :: Proxy s -> Proxy s -> Proxy s -> [Proxy s] #

Eq (Proxy s)

Since: base-4.7.0.0

Instance details

Defined in Data.Proxy

Methods

(==) :: Proxy s -> Proxy s -> Bool #

(/=) :: Proxy s -> Proxy s -> Bool #

Ord (Proxy s)

Since: base-4.7.0.0

Instance details

Defined in Data.Proxy

Methods

compare :: Proxy s -> Proxy s -> Ordering #

(<) :: Proxy s -> Proxy s -> Bool #

(<=) :: Proxy s -> Proxy s -> Bool #

(>) :: Proxy s -> Proxy s -> Bool #

(>=) :: Proxy s -> Proxy s -> Bool #

max :: Proxy s -> Proxy s -> Proxy s #

min :: Proxy s -> Proxy s -> Proxy s #

Read (Proxy t)

Since: base-4.7.0.0

Instance details

Defined in Data.Proxy

Show (Proxy s)

Since: base-4.7.0.0

Instance details

Defined in Data.Proxy

Methods

showsPrec :: Int -> Proxy s -> ShowS #

show :: Proxy s -> String #

showList :: [Proxy s] -> ShowS #

Ix (Proxy s)

Since: base-4.7.0.0

Instance details

Defined in Data.Proxy

Methods

range :: (Proxy s, Proxy s) -> [Proxy s] #

index :: (Proxy s, Proxy s) -> Proxy s -> Int #

unsafeIndex :: (Proxy s, Proxy s) -> Proxy s -> Int

inRange :: (Proxy s, Proxy s) -> Proxy s -> Bool #

rangeSize :: (Proxy s, Proxy s) -> Int #

unsafeRangeSize :: (Proxy s, Proxy s) -> Int

Generic (Proxy t) 
Instance details

Defined in GHC.Generics

Associated Types

type Rep (Proxy t) :: Type -> Type #

Methods

from :: Proxy t -> Rep (Proxy t) x #

to :: Rep (Proxy t) x -> Proxy t #

Semigroup (Proxy s)

Since: base-4.9.0.0

Instance details

Defined in Data.Proxy

Methods

(<>) :: Proxy s -> Proxy s -> Proxy s #

sconcat :: NonEmpty (Proxy s) -> Proxy s #

stimes :: Integral b => b -> Proxy s -> Proxy s #

Monoid (Proxy s)

Since: base-4.7.0.0

Instance details

Defined in Data.Proxy

Methods

mempty :: Proxy s #

mappend :: Proxy s -> Proxy s -> Proxy s #

mconcat :: [Proxy s] -> Proxy s #

Hashable (Proxy a) 
Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> Proxy a -> Int #

hash :: Proxy a -> Int #

ToJSON (Proxy a) 
Instance details

Defined in Data.Aeson.Types.ToJSON

FromJSON (Proxy a) 
Instance details

Defined in Data.Aeson.Types.FromJSON

OCamlType a => OCamlType (Proxy a) Source # 
Instance details

Defined in OCaml.BuckleScript.Types

type Rep1 (Proxy :: k -> Type)

Since: base-4.6.0.0

Instance details

Defined in GHC.Generics

type Rep1 (Proxy :: k -> Type) = D1 (MetaData "Proxy" "Data.Proxy" "base" False) (C1 (MetaCons "Proxy" PrefixI False) (U1 :: k -> Type))
type Rep (Proxy t)

Since: base-4.6.0.0

Instance details

Defined in GHC.Generics

type Rep (Proxy t) = D1 (MetaData "Proxy" "Data.Proxy" "base" False) (C1 (MetaCons "Proxy" PrefixI False) (U1 :: Type -> Type))

data (path :: k) :> a :: forall k. k -> Type -> Type infixr 4 #

The contained API (second argument) can be found under ("/" ++ path) (path being the first argument).

Example:

>>> -- GET /hello/world
>>> -- returning a JSON encoded World value
>>> type MyApi = "hello" :> "world" :> Get '[JSON] World
Instances
HasLink sub => HasLink (HttpVersion :> sub :: Type) 
Instance details

Defined in Servant.Links

Associated Types

type MkLink (HttpVersion :> sub) a :: Type #

Methods

toLink :: (Link -> a) -> Proxy (HttpVersion :> sub) -> Link -> MkLink (HttpVersion :> sub) a #

HasLink sub => HasLink (StreamBody' mods framing ct a :> sub :: Type) 
Instance details

Defined in Servant.Links

Associated Types

type MkLink (StreamBody' mods framing ct a :> sub) a :: Type #

Methods

toLink :: (Link -> a0) -> Proxy (StreamBody' mods framing ct a :> sub) -> Link -> MkLink (StreamBody' mods framing ct a :> sub) a0 #

HasLink sub => HasLink (ReqBody' mods ct a :> sub :: Type) 
Instance details

Defined in Servant.Links

Associated Types

type MkLink (ReqBody' mods ct a :> sub) a :: Type #

Methods

toLink :: (Link -> a0) -> Proxy (ReqBody' mods ct a :> sub) -> Link -> MkLink (ReqBody' mods ct a :> sub) a0 #

HasLink sub => HasLink (RemoteHost :> sub :: Type) 
Instance details

Defined in Servant.Links

Associated Types

type MkLink (RemoteHost :> sub) a :: Type #

Methods

toLink :: (Link -> a) -> Proxy (RemoteHost :> sub) -> Link -> MkLink (RemoteHost :> sub) a #

(KnownSymbol sym, ToHttpApiData v, HasLink sub, SBoolI (FoldRequired mods)) => HasLink (QueryParam' mods sym v :> sub :: Type) 
Instance details

Defined in Servant.Links

Associated Types

type MkLink (QueryParam' mods sym v :> sub) a :: Type #

Methods

toLink :: (Link -> a) -> Proxy (QueryParam' mods sym v :> sub) -> Link -> MkLink (QueryParam' mods sym v :> sub) a #

(KnownSymbol sym, ToHttpApiData v, HasLink sub) => HasLink (QueryParams sym v :> sub :: Type) 
Instance details

Defined in Servant.Links

Associated Types

type MkLink (QueryParams sym v :> sub) a :: Type #

Methods

toLink :: (Link -> a) -> Proxy (QueryParams sym v :> sub) -> Link -> MkLink (QueryParams sym v :> sub) a #

(KnownSymbol sym, HasLink sub) => HasLink (QueryFlag sym :> sub :: Type) 
Instance details

Defined in Servant.Links

Associated Types

type MkLink (QueryFlag sym :> sub) a :: Type #

Methods

toLink :: (Link -> a) -> Proxy (QueryFlag sym :> sub) -> Link -> MkLink (QueryFlag sym :> sub) a #

HasLink sub => HasLink (Header' mods sym a :> sub :: Type) 
Instance details

Defined in Servant.Links

Associated Types

type MkLink (Header' mods sym a :> sub) a :: Type #

Methods

toLink :: (Link -> a0) -> Proxy (Header' mods sym a :> sub) -> Link -> MkLink (Header' mods sym a :> sub) a0 #

HasLink sub => HasLink (IsSecure :> sub :: Type) 
Instance details

Defined in Servant.Links

Associated Types

type MkLink (IsSecure :> sub) a :: Type #

Methods

toLink :: (Link -> a) -> Proxy (IsSecure :> sub) -> Link -> MkLink (IsSecure :> sub) a #

HasLink sub => HasLink (AuthProtect tag :> sub :: Type) 
Instance details

Defined in Servant.Links

Associated Types

type MkLink (AuthProtect tag :> sub) a :: Type #

Methods

toLink :: (Link -> a) -> Proxy (AuthProtect tag :> sub) -> Link -> MkLink (AuthProtect tag :> sub) a #

HasLink sub => HasLink (Summary s :> sub :: Type) 
Instance details

Defined in Servant.Links

Associated Types

type MkLink (Summary s :> sub) a :: Type #

Methods

toLink :: (Link -> a) -> Proxy (Summary s :> sub) -> Link -> MkLink (Summary s :> sub) a #

HasLink sub => HasLink (Description s :> sub :: Type) 
Instance details

Defined in Servant.Links

Associated Types

type MkLink (Description s :> sub) a :: Type #

Methods

toLink :: (Link -> a) -> Proxy (Description s :> sub) -> Link -> MkLink (Description s :> sub) a #

(ToHttpApiData v, HasLink sub) => HasLink (Capture' mods sym v :> sub :: Type) 
Instance details

Defined in Servant.Links

Associated Types

type MkLink (Capture' mods sym v :> sub) a :: Type #

Methods

toLink :: (Link -> a) -> Proxy (Capture' mods sym v :> sub) -> Link -> MkLink (Capture' mods sym v :> sub) a #

(ToHttpApiData v, HasLink sub) => HasLink (CaptureAll sym v :> sub :: Type) 
Instance details

Defined in Servant.Links

Associated Types

type MkLink (CaptureAll sym v :> sub) a :: Type #

Methods

toLink :: (Link -> a) -> Proxy (CaptureAll sym v :> sub) -> Link -> MkLink (CaptureAll sym v :> sub) a #

HasLink sub => HasLink (BasicAuth realm a :> sub :: Type) 
Instance details

Defined in Servant.Links

Associated Types

type MkLink (BasicAuth realm a :> sub) a :: Type #

Methods

toLink :: (Link -> a0) -> Proxy (BasicAuth realm a :> sub) -> Link -> MkLink (BasicAuth realm a :> sub) a0 #

HasLink sub => HasLink (Vault :> sub :: Type) 
Instance details

Defined in Servant.Links

Associated Types

type MkLink (Vault :> sub) a :: Type #

Methods

toLink :: (Link -> a) -> Proxy (Vault :> sub) -> Link -> MkLink (Vault :> sub) a #

(KnownSymbol sym, HasLink sub) => HasLink (sym :> sub :: Type) 
Instance details

Defined in Servant.Links

Associated Types

type MkLink (sym :> sub) a :: Type #

Methods

toLink :: (Link -> a) -> Proxy (sym :> sub) -> Link -> MkLink (sym :> sub) a #

(SingI modules, HasOCamlTypeMetaData' api) => HasOCamlTypeMetaData (OCamlModule modules :> api :: Type) Source #

single module

Instance details

Defined in OCaml.BuckleScript.Internal.Package

(HasOCamlTypeMetaData deps, HasOCamlTypeMetaData modules) => HasOCamlTypeMetaData (OCamlPackage packageName deps :> modules :: Type) Source #

build a packages dependencies and its declared modules

Instance details

Defined in OCaml.BuckleScript.Internal.Package

(SingI modules, HasOCamlModule' api) => HasOCamlModule (OCamlModule modules :> api :: Type) Source # 
Instance details

Defined in OCaml.BuckleScript.Internal.Package

(HasOCamlTypeMetaData deps, HasOCamlTypeMetaData a, HasOCamlPackage' a) => HasOCamlPackage (OCamlPackage packageName deps :> a :: Type) Source # 
Instance details

Defined in OCaml.BuckleScript.Internal.Package

Methods

mkPackage :: Proxy (OCamlPackage packageName deps :> a) -> PackageOptions -> IO () Source #

(TypeError (HasServerArrowKindError arr) :: Constraint) => HasServer (arr :> api :: Type) context

This instance catches mistakes when there are non-saturated type applications on LHS of :>.

>>> serve (Proxy :: Proxy (Capture "foo" :> Get '[JSON] Int)) (error "...")
...
...Expected something of kind Symbol or *, got: k -> l on the LHS of ':>'.
...Maybe you haven't applied enough arguments to
...Capture' '[] "foo"
...
>>> undefined :: Server (Capture "foo" :> Get '[JSON] Int)
...
...Expected something of kind Symbol or *, got: k -> l on the LHS of ':>'.
...Maybe you haven't applied enough arguments to
...Capture' '[] "foo"
...
Instance details

Defined in Servant.Server.Internal

Associated Types

type ServerT (arr :> api) m :: Type #

Methods

route :: Proxy (arr :> api) -> Context context -> Delayed env (Server (arr :> api)) -> Router env #

hoistServerWithContext :: Proxy (arr :> api) -> Proxy context -> (forall x. m x -> n x) -> ServerT (arr :> api) m -> ServerT (arr :> api) n #

HasServer api context => HasServer (HttpVersion :> api :: Type) context 
Instance details

Defined in Servant.Server.Internal

Associated Types

type ServerT (HttpVersion :> api) m :: Type #

Methods

route :: Proxy (HttpVersion :> api) -> Context context -> Delayed env (Server (HttpVersion :> api)) -> Router env #

hoistServerWithContext :: Proxy (HttpVersion :> api) -> Proxy context -> (forall x. m x -> n x) -> ServerT (HttpVersion :> api) m -> ServerT (HttpVersion :> api) n #

(FramingUnrender framing, FromSourceIO chunk a, MimeUnrender ctype chunk, HasServer api context) => HasServer (StreamBody' mods framing ctype a :> api :: Type) context 
Instance details

Defined in Servant.Server.Internal

Associated Types

type ServerT (StreamBody' mods framing ctype a :> api) m :: Type #

Methods

route :: Proxy (StreamBody' mods framing ctype a :> api) -> Context context -> Delayed env (Server (StreamBody' mods framing ctype a :> api)) -> Router env #

hoistServerWithContext :: Proxy (StreamBody' mods framing ctype a :> api) -> Proxy context -> (forall x. m x -> n x) -> ServerT (StreamBody' mods framing ctype a :> api) m -> ServerT (StreamBody' mods framing ctype a :> api) n #

(AllCTUnrender list a, HasServer api context, SBoolI (FoldLenient mods)) => HasServer (ReqBody' mods list a :> api :: Type) context

If you use ReqBody in one of the endpoints for your API, this automatically requires your server-side handler to be a function that takes an argument of the type specified by ReqBody. The Content-Type header is inspected, and the list provided is used to attempt deserialization. If the request does not have a Content-Type header, it is treated as application/octet-stream (as specified in RFC7231. This lets servant worry about extracting it from the request and turning it into a value of the type you specify.

All it asks is for a FromJSON instance.

Example:

type MyApi = "books" :> ReqBody '[JSON] Book :> Post '[JSON] Book

server :: Server MyApi
server = postBook
  where postBook :: Book -> Handler Book
        postBook book = ...insert into your db...
Instance details

Defined in Servant.Server.Internal

Associated Types

type ServerT (ReqBody' mods list a :> api) m :: Type #

Methods

route :: Proxy (ReqBody' mods list a :> api) -> Context context -> Delayed env (Server (ReqBody' mods list a :> api)) -> Router env #

hoistServerWithContext :: Proxy (ReqBody' mods list a :> api) -> Proxy context -> (forall x. m x -> n x) -> ServerT (ReqBody' mods list a :> api) m -> ServerT (ReqBody' mods list a :> api) n #

HasServer api context => HasServer (RemoteHost :> api :: Type) context 
Instance details

Defined in Servant.Server.Internal

Associated Types

type ServerT (RemoteHost :> api) m :: Type #

Methods

route :: Proxy (RemoteHost :> api) -> Context context -> Delayed env (Server (RemoteHost :> api)) -> Router env #

hoistServerWithContext :: Proxy (RemoteHost :> api) -> Proxy context -> (forall x. m x -> n x) -> ServerT (RemoteHost :> api) m -> ServerT (RemoteHost :> api) n #

(KnownSymbol sym, FromHttpApiData a, HasServer api context, SBoolI (FoldRequired mods), SBoolI (FoldLenient mods)) => HasServer (QueryParam' mods sym a :> api :: Type) context

If you use QueryParam "author" Text in one of the endpoints for your API, this automatically requires your server-side handler to be a function that takes an argument of type Maybe Text.

This lets servant worry about looking it up in the query string and turning it into a value of the type you specify, enclosed in Maybe, because it may not be there and servant would then hand you Nothing.

You can control how it'll be converted from Text to your type by simply providing an instance of FromHttpApiData for your type.

Example:

type MyApi = "books" :> QueryParam "author" Text :> Get '[JSON] [Book]

server :: Server MyApi
server = getBooksBy
  where getBooksBy :: Maybe Text -> Handler [Book]
        getBooksBy Nothing       = ...return all books...
        getBooksBy (Just author) = ...return books by the given author...
Instance details

Defined in Servant.Server.Internal

Associated Types

type ServerT (QueryParam' mods sym a :> api) m :: Type #

Methods

route :: Proxy (QueryParam' mods sym a :> api) -> Context context -> Delayed env (Server (QueryParam' mods sym a :> api)) -> Router env #

hoistServerWithContext :: Proxy (QueryParam' mods sym a :> api) -> Proxy context -> (forall x. m x -> n x) -> ServerT (QueryParam' mods sym a :> api) m -> ServerT (QueryParam' mods sym a :> api) n #

(KnownSymbol sym, FromHttpApiData a, HasServer api context) => HasServer (QueryParams sym a :> api :: Type) context

If you use QueryParams "authors" Text in one of the endpoints for your API, this automatically requires your server-side handler to be a function that takes an argument of type [Text].

This lets servant worry about looking up 0 or more values in the query string associated to authors and turning each of them into a value of the type you specify.

You can control how the individual values are converted from Text to your type by simply providing an instance of FromHttpApiData for your type.

Example:

type MyApi = "books" :> QueryParams "authors" Text :> Get '[JSON] [Book]

server :: Server MyApi
server = getBooksBy
  where getBooksBy :: [Text] -> Handler [Book]
        getBooksBy authors = ...return all books by these authors...
Instance details

Defined in Servant.Server.Internal

Associated Types

type ServerT (QueryParams sym a :> api) m :: Type #

Methods

route :: Proxy (QueryParams sym a :> api) -> Context context -> Delayed env (Server (QueryParams sym a :> api)) -> Router env #

hoistServerWithContext :: Proxy (QueryParams sym a :> api) -> Proxy context -> (forall x. m x -> n x) -> ServerT (QueryParams sym a :> api) m -> ServerT (QueryParams sym a :> api) n #

(KnownSymbol sym, HasServer api context) => HasServer (QueryFlag sym :> api :: Type) context

If you use QueryFlag "published" in one of the endpoints for your API, this automatically requires your server-side handler to be a function that takes an argument of type Bool.

Example:

type MyApi = "books" :> QueryFlag "published" :> Get '[JSON] [Book]

server :: Server MyApi
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 details

Defined in Servant.Server.Internal

Associated Types

type ServerT (QueryFlag sym :> api) m :: Type #

Methods

route :: Proxy (QueryFlag sym :> api) -> Context context -> Delayed env (Server (QueryFlag sym :> api)) -> Router env #

hoistServerWithContext :: Proxy (QueryFlag sym :> api) -> Proxy context -> (forall x. m x -> n x) -> ServerT (QueryFlag sym :> api) m -> ServerT (QueryFlag sym :> api) n #

(KnownSymbol sym, FromHttpApiData a, HasServer api context, SBoolI (FoldRequired mods), SBoolI (FoldLenient mods)) => HasServer (Header' mods sym a :> api :: Type) context

If you use Header in one of the endpoints for your API, this automatically requires your server-side handler to be a function that takes an argument of the type specified by Header. This lets servant worry about extracting it from the request and turning it into a value of the type you specify.

All it asks is for a FromHttpApiData instance.

Example:

newtype Referer = Referer Text
  deriving (Eq, Show, FromHttpApiData)

           -- GET /view-my-referer
type MyApi = "view-my-referer" :> Header "Referer" Referer :> Get '[JSON] Referer

server :: Server MyApi
server = viewReferer
  where viewReferer :: Referer -> Handler referer
        viewReferer referer = return referer
Instance details

Defined in Servant.Server.Internal

Associated Types

type ServerT (Header' mods sym a :> api) m :: Type #

Methods

route :: Proxy (Header' mods sym a :> api) -> Context context -> Delayed env (Server (Header' mods sym a :> api)) -> Router env #

hoistServerWithContext :: Proxy (Header' mods sym a :> api) -> Proxy context -> (forall x. m x -> n x) -> ServerT (Header' mods sym a :> api) m -> ServerT (Header' mods sym a :> api) n #

HasServer api context => HasServer (IsSecure :> api :: Type) context 
Instance details

Defined in Servant.Server.Internal

Associated Types

type ServerT (IsSecure :> api) m :: Type #

Methods

route :: Proxy (IsSecure :> api) -> Context context -> Delayed env (Server (IsSecure :> api)) -> Router env #

hoistServerWithContext :: Proxy (IsSecure :> api) -> Proxy context -> (forall x. m x -> n x) -> ServerT (IsSecure :> api) m -> ServerT (IsSecure :> api) n #

HasServer api ctx => HasServer (Summary desc :> api :: Type) ctx

Ignore Summary in server handlers.

Instance details

Defined in Servant.Server.Internal

Associated Types

type ServerT (Summary desc :> api) m :: Type #

Methods

route :: Proxy (Summary desc :> api) -> Context ctx -> Delayed env (Server (Summary desc :> api)) -> Router env #

hoistServerWithContext :: Proxy (Summary desc :> api) -> Proxy ctx -> (forall x. m x -> n x) -> ServerT (Summary desc :> api) m -> ServerT (Summary desc :> api) n #

HasServer api ctx => HasServer (Description desc :> api :: Type) ctx

Ignore Description in server handlers.

Instance details

Defined in Servant.Server.Internal

Associated Types

type ServerT (Description desc :> api) m :: Type #

Methods

route :: Proxy (Description desc :> api) -> Context ctx -> Delayed env (Server (Description desc :> api)) -> Router env #

hoistServerWithContext :: Proxy (Description desc :> api) -> Proxy ctx -> (forall x. m x -> n x) -> ServerT (Description desc :> api) m -> ServerT (Description desc :> api) n #

(KnownSymbol capture, FromHttpApiData a, HasServer api context) => HasServer (Capture' mods capture a :> api :: Type) context

If you use Capture in one of the endpoints for your API, this automatically requires your server-side handler to be a function that takes an argument of the type specified by the Capture. This lets servant worry about getting it from the URL and turning it into a value of the type you specify.

You can control how it'll be converted from Text to your type by simply providing an instance of FromHttpApiData for your type.

Example:

type MyApi = "books" :> Capture "isbn" Text :> Get '[JSON] Book

server :: Server MyApi
server = getBook
  where getBook :: Text -> Handler Book
        getBook isbn = ...
Instance details

Defined in Servant.Server.Internal

Associated Types

type ServerT (Capture' mods capture a :> api) m :: Type #

Methods

route :: Proxy (Capture' mods capture a :> api) -> Context context -> Delayed env (Server (Capture' mods capture a :> api)) -> Router env #

hoistServerWithContext :: Proxy (Capture' mods capture a :> api) -> Proxy context -> (forall x. m x -> n x) -> ServerT (Capture' mods capture a :> api) m -> ServerT (Capture' mods capture a :> api) n #

(KnownSymbol capture, FromHttpApiData a, HasServer api context) => HasServer (CaptureAll capture a :> api :: Type) context

If you use CaptureAll in one of the endpoints for your API, this automatically requires your server-side handler to be a function that takes an argument of a list of the type specified by the CaptureAll. This lets servant worry about getting values from the URL and turning them into values of the type you specify.

You can control how they'll be converted from Text to your type by simply providing an instance of FromHttpApiData for your type.

Example:

type MyApi = "src" :> CaptureAll "segments" Text :> Get '[JSON] SourceFile

server :: Server MyApi
server = getSourceFile
  where getSourceFile :: [Text] -> Handler Book
        getSourceFile pathSegments = ...
Instance details

Defined in Servant.Server.Internal

Associated Types

type ServerT (CaptureAll capture a :> api) m :: Type #

Methods

route :: Proxy (CaptureAll capture a :> api) -> Context context -> Delayed env (Server (CaptureAll capture a :> api)) -> Router env #

hoistServerWithContext :: Proxy (CaptureAll capture a :> api) -> Proxy context -> (forall x. m x -> n x) -> ServerT (CaptureAll capture a :> api) m -> ServerT (CaptureAll capture a :> api) n #

(KnownSymbol realm, HasServer api context, HasContextEntry context (BasicAuthCheck usr)) => HasServer (BasicAuth realm usr :> api :: Type) context

Basic Authentication

Instance details

Defined in Servant.Server.Internal

Associated Types

type ServerT (BasicAuth realm usr :> api) m :: Type #

Methods

route :: Proxy (BasicAuth realm usr :> api) -> Context context -> Delayed env (Server (BasicAuth realm usr :> api)) -> Router env #

hoistServerWithContext :: Proxy (BasicAuth realm usr :> api) -> Proxy context -> (forall x. m x -> n x) -> ServerT (BasicAuth realm usr :> api) m -> ServerT (BasicAuth realm usr :> api) n #

HasServer api context => HasServer (Vault :> api :: Type) context 
Instance details

Defined in Servant.Server.Internal

Associated Types

type ServerT (Vault :> api) m :: Type #

Methods

route :: Proxy (Vault :> api) -> Context context -> Delayed env (Server (Vault :> api)) -> Router env #

hoistServerWithContext :: Proxy (Vault :> api) -> Proxy context -> (forall x. m x -> n x) -> ServerT (Vault :> api) m -> ServerT (Vault :> api) n #

(KnownSymbol path, HasServer api context) => HasServer (path :> api :: Type) context

Make sure the incoming request starts with "/path", strip it and pass the rest of the request path to api.

Instance details

Defined in Servant.Server.Internal

Associated Types

type ServerT (path :> api) m :: Type #

Methods

route :: Proxy (path :> api) -> Context context -> Delayed env (Server (path :> api)) -> Router env #

hoistServerWithContext :: Proxy (path :> api) -> Proxy context -> (forall x. m x -> n x) -> ServerT (path :> api) m -> ServerT (path :> api) n #

type MkLink (HttpVersion :> sub :: Type) a 
Instance details

Defined in Servant.Links

type MkLink (HttpVersion :> sub :: Type) a = MkLink sub a
type MkLink (StreamBody' mods framing ct a :> sub :: Type) r 
Instance details

Defined in Servant.Links

type MkLink (StreamBody' mods framing ct a :> sub :: Type) r = MkLink sub r
type MkLink (ReqBody' mods ct a :> sub :: Type) r 
Instance details

Defined in Servant.Links

type MkLink (ReqBody' mods ct a :> sub :: Type) r = MkLink sub r
type MkLink (RemoteHost :> sub :: Type) a 
Instance details

Defined in Servant.Links

type MkLink (RemoteHost :> sub :: Type) a = MkLink sub a
type MkLink (QueryParam' mods sym v :> sub :: Type) a 
Instance details

Defined in Servant.Links

type MkLink (QueryParam' mods sym v :> sub :: Type) a = If (FoldRequired mods) v (Maybe v) -> MkLink sub a
type MkLink (QueryParams sym v :> sub :: Type) a 
Instance details

Defined in Servant.Links

type MkLink (QueryParams sym v :> sub :: Type) a = [v] -> MkLink sub a
type MkLink (QueryFlag sym :> sub :: Type) a 
Instance details

Defined in Servant.Links

type MkLink (QueryFlag sym :> sub :: Type) a = Bool -> MkLink sub a
type MkLink (Header' mods sym a :> sub :: Type) r 
Instance details

Defined in Servant.Links

type MkLink (Header' mods sym a :> sub :: Type) r = MkLink sub r
type MkLink (IsSecure :> sub :: Type) a 
Instance details

Defined in Servant.Links

type MkLink (IsSecure :> sub :: Type) a = MkLink sub a
type MkLink (AuthProtect tag :> sub :: Type) a 
Instance details

Defined in Servant.Links

type MkLink (AuthProtect tag :> sub :: Type) a = MkLink sub a
type MkLink (Summary s :> sub :: Type) a 
Instance details

Defined in Servant.Links

type MkLink (Summary s :> sub :: Type) a = MkLink sub a
type MkLink (Description s :> sub :: Type) a 
Instance details

Defined in Servant.Links

type MkLink (Description s :> sub :: Type) a = MkLink sub a
type MkLink (Capture' mods sym v :> sub :: Type) a 
Instance details

Defined in Servant.Links

type MkLink (Capture' mods sym v :> sub :: Type) a = v -> MkLink sub a
type MkLink (CaptureAll sym v :> sub :: Type) a 
Instance details

Defined in Servant.Links

type MkLink (CaptureAll sym v :> sub :: Type) a = [v] -> MkLink sub a
type MkLink (BasicAuth realm a :> sub :: Type) r 
Instance details

Defined in Servant.Links

type MkLink (BasicAuth realm a :> sub :: Type) r = MkLink sub r
type MkLink (Vault :> sub :: Type) a 
Instance details

Defined in Servant.Links

type MkLink (Vault :> sub :: Type) a = MkLink sub a
type MkLink (sym :> sub :: Type) a 
Instance details

Defined in Servant.Links

type MkLink (sym :> sub :: Type) a = MkLink sub a
type ServerT (arr :> api :: Type) m 
Instance details

Defined in Servant.Server.Internal

type ServerT (arr :> api :: Type) m = (TypeError (HasServerArrowKindError arr) :: Type)
type ServerT (HttpVersion :> api :: Type) m 
Instance details

Defined in Servant.Server.Internal

type ServerT (HttpVersion :> api :: Type) m = HttpVersion -> ServerT api m
type ServerT (StreamBody' mods framing ctype a :> api :: Type) m 
Instance details

Defined in Servant.Server.Internal

type ServerT (StreamBody' mods framing ctype a :> api :: Type) m = a -> ServerT api m
type ServerT (ReqBody' mods list a :> api :: Type) m 
Instance details

Defined in Servant.Server.Internal

type ServerT (ReqBody' mods list a :> api :: Type) m = If (FoldLenient mods) (Either String a) a -> ServerT api m
type ServerT (RemoteHost :> api :: Type) m 
Instance details

Defined in Servant.Server.Internal

type ServerT (RemoteHost :> api :: Type) m = SockAddr -> ServerT api m
type ServerT (QueryParam' mods sym a :> api :: Type) m 
Instance details

Defined in Servant.Server.Internal

type ServerT (QueryParam' mods sym a :> api :: Type) m = RequestArgument mods a -> ServerT api m
type ServerT (QueryParams sym a :> api :: Type) m 
Instance details

Defined in Servant.Server.Internal

type ServerT (QueryParams sym a :> api :: Type) m = [a] -> ServerT api m
type ServerT (QueryFlag sym :> api :: Type) m 
Instance details

Defined in Servant.Server.Internal

type ServerT (QueryFlag sym :> api :: Type) m = Bool -> ServerT api m
type ServerT (Header' mods sym a :> api :: Type) m 
Instance details

Defined in Servant.Server.Internal

type ServerT (Header' mods sym a :> api :: Type) m = RequestArgument mods a -> ServerT api m
type ServerT (IsSecure :> api :: Type) m 
Instance details

Defined in Servant.Server.Internal

type ServerT (IsSecure :> api :: Type) m = IsSecure -> ServerT api m
type ServerT (Summary desc :> api :: Type) m 
Instance details

Defined in Servant.Server.Internal

type ServerT (Summary desc :> api :: Type) m = ServerT api m
type ServerT (Description desc :> api :: Type) m 
Instance details

Defined in Servant.Server.Internal

type ServerT (Description desc :> api :: Type) m = ServerT api m
type ServerT (Capture' mods capture a :> api :: Type) m 
Instance details

Defined in Servant.Server.Internal

type ServerT (Capture' mods capture a :> api :: Type) m = a -> ServerT api m
type ServerT (CaptureAll capture a :> api :: Type) m 
Instance details

Defined in Servant.Server.Internal

type ServerT (CaptureAll capture a :> api :: Type) m = [a] -> ServerT api m
type ServerT (BasicAuth realm usr :> api :: Type) m 
Instance details

Defined in Servant.Server.Internal

type ServerT (BasicAuth realm usr :> api :: Type) m = usr -> ServerT api m
type ServerT (Vault :> api :: Type) m 
Instance details

Defined in Servant.Server.Internal

type ServerT (Vault :> api :: Type) m = Vault -> ServerT api m
type ServerT (path :> api :: Type) m 
Instance details

Defined in Servant.Server.Internal

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

data a :<|> b infixr 3 #

Union of two APIs, first takes precedence in case of overlap.

Example:

>>> :{
type MyApi = "books" :> Get '[JSON] [Book] -- GET /books
       :<|> "books" :> ReqBody '[JSON] Book :> Post '[JSON] () -- POST /books
:}

Constructors

a :<|> b infixr 3 
Instances
Bitraversable (:<|>) 
Instance details

Defined in Servant.API.Alternative

Methods

bitraverse :: Applicative f => (a -> f c) -> (b -> f d) -> (a :<|> b) -> f (c :<|> d) #

Bifoldable (:<|>) 
Instance details

Defined in Servant.API.Alternative

Methods

bifold :: Monoid m => (m :<|> m) -> m #

bifoldMap :: Monoid m => (a -> m) -> (b -> m) -> (a :<|> b) -> m #

bifoldr :: (a -> c -> c) -> (b -> c -> c) -> c -> (a :<|> b) -> c #

bifoldl :: (c -> a -> c) -> (c -> b -> c) -> c -> (a :<|> b) -> c #

Bifunctor (:<|>) 
Instance details

Defined in Servant.API.Alternative

Methods

bimap :: (a -> b) -> (c -> d) -> (a :<|> c) -> b :<|> d #

first :: (a -> b) -> (a :<|> c) -> b :<|> c #

second :: (b -> c) -> (a :<|> b) -> a :<|> c #

Biapplicative (:<|>) 
Instance details

Defined in Servant.API.Alternative

Methods

bipure :: a -> b -> a :<|> b #

(<<*>>) :: ((a -> b) :<|> (c -> d)) -> (a :<|> c) -> b :<|> d #

biliftA2 :: (a -> b -> c) -> (d -> e -> f) -> (a :<|> d) -> (b :<|> e) -> c :<|> f #

(*>>) :: (a :<|> b) -> (c :<|> d) -> c :<|> d #

(<<*) :: (a :<|> b) -> (c :<|> d) -> a :<|> b #

Functor ((:<|>) a) 
Instance details

Defined in Servant.API.Alternative

Methods

fmap :: (a0 -> b) -> (a :<|> a0) -> a :<|> b #

(<$) :: a0 -> (a :<|> b) -> a :<|> a0 #

Foldable ((:<|>) a) 
Instance details

Defined in Servant.API.Alternative

Methods

fold :: Monoid m => (a :<|> m) -> m #

foldMap :: Monoid m => (a0 -> m) -> (a :<|> a0) -> m #

foldr :: (a0 -> b -> b) -> b -> (a :<|> a0) -> b #

foldr' :: (a0 -> b -> b) -> b -> (a :<|> a0) -> b #

foldl :: (b -> a0 -> b) -> b -> (a :<|> a0) -> b #

foldl' :: (b -> a0 -> b) -> b -> (a :<|> a0) -> b #

foldr1 :: (a0 -> a0 -> a0) -> (a :<|> a0) -> a0 #

foldl1 :: (a0 -> a0 -> a0) -> (a :<|> a0) -> a0 #

toList :: (a :<|> a0) -> [a0] #

null :: (a :<|> a0) -> Bool #

length :: (a :<|> a0) -> Int #

elem :: Eq a0 => a0 -> (a :<|> a0) -> Bool #

maximum :: Ord a0 => (a :<|> a0) -> a0 #

minimum :: Ord a0 => (a :<|> a0) -> a0 #

sum :: Num a0 => (a :<|> a0) -> a0 #

product :: Num a0 => (a :<|> a0) -> a0 #

Traversable ((:<|>) a) 
Instance details

Defined in Servant.API.Alternative

Methods

traverse :: Applicative f => (a0 -> f b) -> (a :<|> a0) -> f (a :<|> b) #

sequenceA :: Applicative f => (a :<|> f a0) -> f (a :<|> a0) #

mapM :: Monad m => (a0 -> m b) -> (a :<|> a0) -> m (a :<|> b) #

sequence :: Monad m => (a :<|> m a0) -> m (a :<|> a0) #

(HasLink a, HasLink b) => HasLink (a :<|> b :: Type) 
Instance details

Defined in Servant.Links

Associated Types

type MkLink (a :<|> b) a :: Type #

Methods

toLink :: (Link -> a0) -> Proxy (a :<|> b) -> Link -> MkLink (a :<|> b) a0 #

(HasOCamlTypeMetaData modul, HasOCamlTypeMetaData rst) => HasOCamlTypeMetaData (modul :<|> rst :: Type) Source #

modules

Instance details

Defined in OCaml.BuckleScript.Internal.Package

(HasOCamlTypeMetaData (OCamlPackage packageName deps), HasOCamlTypeMetaData rest) => HasOCamlTypeMetaData (OCamlPackage packageName deps :<|> rest :: Type) Source #

packages

Instance details

Defined in OCaml.BuckleScript.Internal.Package

(HasServer a context, HasServer b context) => HasServer (a :<|> b :: Type) context

A server for a :<|> b first tries to match the request against the route represented by a and if it fails tries b. You must provide a request handler for each route.

type MyApi = "books" :> Get '[JSON] [Book] -- GET /books
        :<|> "books" :> ReqBody Book :> Post '[JSON] Book -- POST /books

server :: Server MyApi
server = listAllBooks :<|> postBook
  where listAllBooks = ...
        postBook book = ...
Instance details

Defined in Servant.Server.Internal

Associated Types

type ServerT (a :<|> b) m :: Type #

Methods

route :: Proxy (a :<|> b) -> Context context -> Delayed env (Server (a :<|> b)) -> Router env #

hoistServerWithContext :: Proxy (a :<|> b) -> Proxy context -> (forall x. m x -> n x) -> ServerT (a :<|> b) m -> ServerT (a :<|> b) n #

(Bounded a, Bounded b) => Bounded (a :<|> b) 
Instance details

Defined in Servant.API.Alternative

Methods

minBound :: a :<|> b #

maxBound :: a :<|> b #

(Eq a, Eq b) => Eq (a :<|> b) 
Instance details

Defined in Servant.API.Alternative

Methods

(==) :: (a :<|> b) -> (a :<|> b) -> Bool #

(/=) :: (a :<|> b) -> (a :<|> b) -> Bool #

(Show a, Show b) => Show (a :<|> b) 
Instance details

Defined in Servant.API.Alternative

Methods

showsPrec :: Int -> (a :<|> b) -> ShowS #

show :: (a :<|> b) -> String #

showList :: [a :<|> b] -> ShowS #

(Semigroup a, Semigroup b) => Semigroup (a :<|> b) 
Instance details

Defined in Servant.API.Alternative

Methods

(<>) :: (a :<|> b) -> (a :<|> b) -> a :<|> b #

sconcat :: NonEmpty (a :<|> b) -> a :<|> b #

stimes :: Integral b0 => b0 -> (a :<|> b) -> a :<|> b #

(Monoid a, Monoid b) => Monoid (a :<|> b) 
Instance details

Defined in Servant.API.Alternative

Methods

mempty :: a :<|> b #

mappend :: (a :<|> b) -> (a :<|> b) -> a :<|> b #

mconcat :: [a :<|> b] -> a :<|> b #

type MkLink (a :<|> b :: Type) r 
Instance details

Defined in Servant.Links

type MkLink (a :<|> b :: Type) r = MkLink a r :<|> MkLink b r
type ServerT (a :<|> b :: Type) m 
Instance details

Defined in Servant.Server.Internal

type ServerT (a :<|> b :: Type) m = ServerT a m :<|> ServerT b m

type Application = Request -> (Response -> IO ResponseReceived) -> IO ResponseReceived #

The WAI application.

Note that, since WAI 3.0, this type is structured in continuation passing style to allow for proper safe resource handling. This was handled in the past via other means (e.g., ResourceT). As a demonstration:

app :: Application
app req respond = bracket_
    (putStrLn "Allocating scarce resource")
    (putStrLn "Cleaning up")
    (respond $ responseLBS status200 [] "Hello World")

type Server (api :: k) = ServerT api Handler #

serve :: HasServer api ([] :: [Type]) => Proxy api -> Server api -> Application #

serve allows you to implement an API and produce a wai Application.

Example:

type MyApi = "books" :> Get '[JSON] [Book] -- GET /books
        :<|> "books" :> ReqBody Book :> Post '[JSON] Book -- POST /books

server :: Server MyApi
server = listAllBooks :<|> postBook
  where listAllBooks = ...
        postBook book = ...

myApi :: Proxy MyApi
myApi = Proxy

app :: Application
app = serve myApi server

main :: IO ()
main = Network.Wai.Handler.Warp.run 8080 app