hslua-aeson-1.0.0: Allow aeson data types to be used with lua.

Copyright© 2017–2018 Albert Krewinkel
LicenseMIT
MaintainerAlbert Krewinkel <tarleb@zeitkraut.de>
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Foreign.Lua.Aeson

Contents

Description

Glue to hslua for aeson values.

This provides a StackValue instance for aeson's Value type. The following conventions are used:

  • Null values are encoded as a special value (stored in the registry field HSLUA_AESON_NULL). Using nil would cause problems with null-containing arrays.
  • Objects are converted to tables in a straight-forward way.
  • Arrays are converted to lua tables. Array-length is included as the value at index 0. This makes it possible to distinguish between empty arrays and empty objects.
  • JSON numbers are converted to Lua numbers (usually doubles), which can cause a loss of precision.
Synopsis

Documentation

pushNull :: Lua () Source #

Push the value which represents JSON null values to the stack (a specific empty table by default). Internally, this uses the contents of the HSLUA_AESON_NULL registry field; modifying this field is possible, but it must always be non-nil.

Orphan instances

Peekable Scientific Source # 
Instance details

Peekable Value Source # 
Instance details

Methods

peek :: StackIndex -> Lua Value #

Pushable Scientific Source # 
Instance details

Methods

push :: Scientific -> Lua () #

Pushable Value Source #

Hslua StackValue instance for the Aeson Value data type.

Instance details

Methods

push :: Value -> Lua () #

Peekable a => Peekable (Vector a) Source # 
Instance details

Methods

peek :: StackIndex -> Lua (Vector a) #

Pushable a => Pushable (Vector a) Source # 
Instance details

Methods

push :: Vector a -> Lua () #

(Eq a, Hashable a, Peekable a, Peekable b) => Peekable (HashMap a b) Source # 
Instance details

Methods

peek :: StackIndex -> Lua (HashMap a b) #

(Eq a, Hashable a, Pushable a, Pushable b) => Pushable (HashMap a b) Source # 
Instance details

Methods

push :: HashMap a b -> Lua () #