generated from tpl/purs
e392713273
- Bumped dependencies - Use generic rep - New operator syntax - New qualified import syntax
1.6 KiB
1.6 KiB
Module Data.YAML.Foreign.Encode
YObject
type YObject = Map String YValue
YArray
type YArray = Array YValue
YAML
data YAML :: Type
YValue
data YValue
= YObject YObject
| YArray YArray
| YString String
| YNumber Number
| YInt Int
| YBoolean Boolean
| YNull
Instances
Show YValue
Eq YValue
ToYAML
class ToYAML a where
toYAML :: a -> YValue
Instances
ToYAML Boolean
ToYAML Int
ToYAML Number
ToYAML String
(ToYAML a) => ToYAML (Array a)
(ToYAML a) => ToYAML (Maybe a)
Pair
type Pair = Tuple String YValue
entry
entry :: forall a. ToYAML a => String -> a -> Pair
Helper function to create a key-value tuple for a YAML object.
name = "Name" := "This is the name"
(:=)
infixl 4 entry as :=
object
object :: Array Pair -> YValue
Helper function to create a YAML object.
obj = object [ "Name" := "This is the name", "Size" := 1.5 ]
jsNull
jsNull :: YAML
objToHash
objToHash :: Fn4 (YValue -> YAML) (Tuple String YValue -> String) (Tuple String YValue -> YValue) (Array (Tuple String YValue)) YAML
valueToYAML
valueToYAML :: YValue -> YAML
toYAMLImpl
toYAMLImpl :: YAML -> String
printYAML
printYAML :: forall a. ToYAML a => a -> String