2015-12-20 14:35:04 +00:00
|
|
|
## Module Data.YAML.Foreign.Encode
|
|
|
|
|
|
|
|
#### `YObject`
|
|
|
|
|
|
|
|
``` purescript
|
|
|
|
type YObject = Map String YValue
|
|
|
|
```
|
|
|
|
|
|
|
|
#### `YArray`
|
|
|
|
|
|
|
|
``` purescript
|
|
|
|
type YArray = Array YValue
|
|
|
|
```
|
|
|
|
|
|
|
|
#### `YAML`
|
|
|
|
|
|
|
|
``` purescript
|
2017-02-04 18:47:10 +00:00
|
|
|
data YAML :: Type
|
2015-12-20 14:35:04 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
#### `YValue`
|
|
|
|
|
|
|
|
``` purescript
|
|
|
|
data YValue
|
|
|
|
= YObject YObject
|
|
|
|
| YArray YArray
|
|
|
|
| YString String
|
|
|
|
| YNumber Number
|
|
|
|
| YInt Int
|
|
|
|
| YBoolean Boolean
|
|
|
|
| YNull
|
|
|
|
```
|
|
|
|
|
|
|
|
##### Instances
|
|
|
|
``` purescript
|
|
|
|
Show YValue
|
|
|
|
Eq YValue
|
|
|
|
```
|
|
|
|
|
|
|
|
#### `ToYAML`
|
|
|
|
|
|
|
|
``` purescript
|
2017-02-04 18:47:10 +00:00
|
|
|
class ToYAML a where
|
2015-12-20 14:35:04 +00:00
|
|
|
toYAML :: a -> YValue
|
|
|
|
```
|
|
|
|
|
|
|
|
##### Instances
|
|
|
|
``` purescript
|
|
|
|
ToYAML Boolean
|
|
|
|
ToYAML Int
|
|
|
|
ToYAML Number
|
|
|
|
ToYAML String
|
|
|
|
(ToYAML a) => ToYAML (Array a)
|
|
|
|
(ToYAML a) => ToYAML (Maybe a)
|
|
|
|
```
|
|
|
|
|
|
|
|
#### `Pair`
|
|
|
|
|
|
|
|
``` purescript
|
|
|
|
type Pair = Tuple String YValue
|
|
|
|
```
|
|
|
|
|
2017-02-04 18:47:10 +00:00
|
|
|
#### `entry`
|
2015-12-20 14:35:04 +00:00
|
|
|
|
|
|
|
``` purescript
|
2017-02-04 18:47:10 +00:00
|
|
|
entry :: forall a. ToYAML a => String -> a -> Pair
|
2015-12-20 14:35:04 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
Helper function to create a key-value tuple for a YAML object.
|
|
|
|
|
|
|
|
`name = "Name" := "This is the name"`
|
|
|
|
|
2017-02-04 18:47:10 +00:00
|
|
|
#### `(:=)`
|
|
|
|
|
|
|
|
``` purescript
|
|
|
|
infixl 4 entry as :=
|
|
|
|
```
|
|
|
|
|
2015-12-20 14:35:04 +00:00
|
|
|
#### `object`
|
|
|
|
|
|
|
|
``` purescript
|
|
|
|
object :: Array Pair -> YValue
|
|
|
|
```
|
|
|
|
|
|
|
|
Helper function to create a YAML object.
|
|
|
|
|
|
|
|
`obj = object [ "Name" := "This is the name", "Size" := 1.5 ]`
|
|
|
|
|
|
|
|
#### `jsNull`
|
|
|
|
|
|
|
|
``` purescript
|
|
|
|
jsNull :: YAML
|
|
|
|
```
|
|
|
|
|
|
|
|
#### `objToHash`
|
|
|
|
|
|
|
|
``` purescript
|
|
|
|
objToHash :: Fn4 (YValue -> YAML) (Tuple String YValue -> String) (Tuple String YValue -> YValue) (Array (Tuple String YValue)) YAML
|
|
|
|
```
|
|
|
|
|
|
|
|
#### `valueToYAML`
|
|
|
|
|
|
|
|
``` purescript
|
|
|
|
valueToYAML :: YValue -> YAML
|
|
|
|
```
|
|
|
|
|
|
|
|
#### `toYAMLImpl`
|
|
|
|
|
|
|
|
``` purescript
|
|
|
|
toYAMLImpl :: YAML -> String
|
|
|
|
```
|
|
|
|
|
|
|
|
#### `printYAML`
|
|
|
|
|
|
|
|
``` purescript
|
2017-02-04 18:47:10 +00:00
|
|
|
printYAML :: forall a. ToYAML a => a -> String
|
2015-12-20 14:35:04 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
|