Module

Data.Options

Package
purescript-options
Repository
ethul/purescript-options

#Options Source

newtype Options opt

The Options type represents a set of options. The type argument is a phantom type, which is useful for ensuring that options for one particular API are not accidentally passed to some other API.

Constructors

Instances

#options Source

options :: forall opt. Options opt -> Foreign

Convert an Options value into a JavaScript object, suitable for passing to JavaScript APIs.

#Option Source

type Option opt = Op (Options opt)

An Option represents an opportunity to configure a specific attribute of a call to some API. This normally corresponds to one specific property of an "options" object in JavaScript APIs, but can in general correspond to zero or more actual properties.

#assoc Source

assoc :: forall value opt. Option opt value -> value -> Options opt

Associates a value with a specific option.

#(:=) Source

Operator alias for Data.Options.assoc (right-associative / precedence 6)

An infix version of assoc.

#optional Source

optional :: forall value opt. Option opt value -> Option opt (Maybe value)

A version of assoc which takes possibly absent values. Nothing values are ignored; passing Nothing for the second argument will result in an empty Options.

#opt Source

opt :: forall value opt. String -> Option opt value

The default way of creating Option values. Constructs an Option with the given key, which passes the given value through unchanged.

#tag Source

tag :: forall value opt. Option opt value -> value -> Option opt Unit

Create a tag, by fixing an Option to a single value.

#defaultToOptions Source

defaultToOptions :: forall value opt. String -> value -> Options opt

The default method for turning a string property key into an Option. This function simply calls toForeign on the value. If you need some other behaviour, you can write your own function to replace this one, and construct an Option yourself.

Modules
Data.Options