Safe Haskell | None |
---|---|
Language | Haskell2010 |
Servant.PureScript
- class HasBridge a where
- languageBridge :: HasBridge a => Proxy a -> FullBridge
- defaultBridge :: BridgePart
- defaultBridgeProxy :: Proxy DefaultBridge
- data DefaultBridge
- writeAPIModule :: forall bridgeSelector api. (HasForeign (PureScript bridgeSelector) PSType api, GenerateList PSType (Foreign PSType api), HasBridge bridgeSelector) => FilePath -> Proxy bridgeSelector -> Proxy api -> IO ()
- writeAPIModuleWithSettings :: forall bridgeSelector api. (HasForeign (PureScript bridgeSelector) PSType api, GenerateList PSType (Foreign PSType api), HasBridge bridgeSelector) => Settings -> FilePath -> Proxy bridgeSelector -> Proxy api -> IO ()
- data Settings = Settings {}
- apiModuleName :: Lens' Settings Text
- readerParams :: Lens' Settings (Set ParamName)
- standardImports :: Lens' Settings ImportLines
- defaultSettings :: Settings
- addReaderParam :: ParamName -> Settings -> Settings
- jsonParseUrlPiece :: FromJSON a => Text -> Either Text a
- jsonToUrlPiece :: ToJSON a => a -> Text
- jsonParseHeader :: FromJSON a => ByteString -> Either Text a
- jsonToHeader :: ToJSON a => a -> ByteString
Documentation
class HasBridge a where Source #
Minimal complete definition
Methods
languageBridge :: Proxy a -> FullBridge Source #
Instances
HasBridge DefaultBridge Source # |
|
languageBridge :: HasBridge a => Proxy a -> FullBridge Source #
Default bridge for mapping primitive/common types: You can append your own bridges like this:
defaultBridge <|> myBridge1 <|> myBridge2
Find examples for bridge definitions in Language.PureScript.Bridge.Primitives and Language.PureScript.Bridge.Tuple.
defaultBridgeProxy :: Proxy DefaultBridge Source #
A proxy for DefaultBridge
data DefaultBridge Source #
Use PureScript
DefaultBridge
if defaultBridge
suffices for your needs.
Instances
HasBridge DefaultBridge Source # |
|
writeAPIModule :: forall bridgeSelector api. (HasForeign (PureScript bridgeSelector) PSType api, GenerateList PSType (Foreign PSType api), HasBridge bridgeSelector) => FilePath -> Proxy bridgeSelector -> Proxy api -> IO () Source #
Standard entry point - just create a purescript module with default settings for accessing the servant API.
writeAPIModuleWithSettings :: forall bridgeSelector api. (HasForeign (PureScript bridgeSelector) PSType api, GenerateList PSType (Foreign PSType api), HasBridge bridgeSelector) => Settings -> FilePath -> Proxy bridgeSelector -> Proxy api -> IO () Source #
Constructors
Settings | |
Fields
|
addReaderParam :: ParamName -> Settings -> Settings Source #
Add a parameter name to be us put in the Reader monad instead of being passed to the generated functions.
jsonParseUrlPiece :: FromJSON a => Text -> Either Text a Source #
Use this function for implementing parseUrlPiece
in your FromHttpApiData instances
in order to be compatible with the generated PS code.
instance ToHttpApiData MyDataType where toUrlPiece = jsonToUrlPiece toHeader = jsonToHeader instance FromHttpApiData MyDataType where parseUrlPiece = jsonParseUrlPiece parseHeader = jsonParseHeader
jsonToUrlPiece :: ToJSON a => a -> Text Source #
Use this function for implementing toUrlPiece
in your ToHttpApiData instances
in order to be compatible with the generated PS code.
jsonParseHeader :: FromJSON a => ByteString -> Either Text a Source #
Use this function for implementing parseHeader
in your FromHttpApiData instances
in order to be compatible with the generated PS code.
jsonToHeader :: ToJSON a => a -> ByteString Source #
Use this function for implementing toHeader
in your ToHttpApiData instances
in order to be compatible with the generated PS code.