servant-purescript-0.10.0.0: Generate PureScript accessor functions for you servant API

Safe HaskellNone
LanguageHaskell2010

Servant.PureScript.Internal

Synopsis

Documentation

data PureScript bridgeSelector Source #

Our language type is Paramized, so you can choose a custom TypeBridge for your translation, by providing your own data type and implementing HasBridge for it.

data MyBridge

myBridge :: TypeBridge
myBridge = defaultBridge <|> customBridge1 <|> customBridge2

instance HasBridge MyBridge where
  languageBridge _ = myBridge
Instances
(Typeable a, HasBridge bridgeSelector) => HasForeignType (PureScript bridgeSelector :: Type) PSType (a :: Type) Source # 
Instance details

Defined in Servant.PureScript.Internal

Methods

typeFor :: Proxy (PureScript bridgeSelector) -> Proxy PSType -> Proxy a -> PSType #

data Param f Source #

Constructors

Param 

Fields

Instances
Eq f => Eq (Param f) Source # 
Instance details

Defined in Servant.PureScript.Internal

Methods

(==) :: Param f -> Param f -> Bool #

(/=) :: Param f -> Param f -> Bool #

Ord f => Ord (Param f) Source # 
Instance details

Defined in Servant.PureScript.Internal

Methods

compare :: Param f -> Param f -> Ordering #

(<) :: Param f -> Param f -> Bool #

(<=) :: Param f -> Param f -> Bool #

(>) :: Param f -> Param f -> Bool #

(>=) :: Param f -> Param f -> Bool #

max :: Param f -> Param f -> Param f #

min :: Param f -> Param f -> Param f #

Show f => Show (Param f) Source # 
Instance details

Defined in Servant.PureScript.Internal

Methods

showsPrec :: Int -> Param f -> ShowS #

show :: Param f -> String #

showList :: [Param f] -> ShowS #

pType :: forall f f. Lens (Param f) (Param f) f f Source #

pName :: forall f. Lens' (Param f) ParamName Source #

data Settings Source #

Constructors

Settings 

Fields

  • _apiModuleName :: Text
     
  • _readerParams :: Set ParamName

    This function parameters should instead be put in a Reader monad.

    baseUrl will be put there by default, you can add additional parameters.

    If your API uses a given parameter name multiple times with different types, only the ones matching the type of the first occurrence will be put in the Reader monad, all others will still be passed as function parameter.

  • _standardImports :: ImportLines
     
  • _generateSubscriberAPI :: Bool

    If you want codegen for servant-subscriber, set this to True. See the central-counter example for a simple usage case.

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.

apiToList :: forall bridgeSelector api. (HasForeign (PureScript bridgeSelector) PSType api, GenerateList PSType (Foreign PSType api), HasBridge bridgeSelector) => Proxy api -> Proxy bridgeSelector -> [Req PSType] Source #

toPSVarName :: Text -> Text Source #

Transform a given identifer to be a valid PureScript variable name (hopefully).