mirror of
https://github.com/luau-lang/luau.git
synced 2025-05-04 10:33:46 +01:00
Added more bindings from Data.Aeson
This commit is contained in:
parent
4fbca71dcd
commit
dbbe6788f5
4 changed files with 34 additions and 3 deletions
|
@ -1,16 +1,34 @@
|
|||
module FFI.Data.Aeson where
|
||||
|
||||
open import Agda.Builtin.Bool using (Bool)
|
||||
open import Agda.Builtin.String using (String)
|
||||
|
||||
open import FFI.Data.ByteString using (ByteString)
|
||||
open import FFI.Data.HaskellString using (HaskellString; pack)
|
||||
open import FFI.Data.Maybe using (Maybe)
|
||||
open import FFI.Data.Either using (Either; mapLeft)
|
||||
open import FFI.Data.Scientific using (Scientific)
|
||||
open import FFI.Data.Vector using (Vector)
|
||||
|
||||
{-# FOREIGN GHC import qualified Data.Aeson #-}
|
||||
{-# FOREIGN GHC import qualified Data.Aeson.KeyMap #-}
|
||||
|
||||
postulate Value : Set
|
||||
{-# COMPILE GHC Value = type Data.Aeson.Value #-}
|
||||
postulate KeyMap : Set → Set
|
||||
{-# POLARITY KeyMap ++ #-}
|
||||
{-# COMPILE GHC KeyMap = type Data.Aeson.KeyMap.KeyMap #-}
|
||||
|
||||
data Value : Set where
|
||||
object : KeyMap Value → Value
|
||||
array : Vector Value → Value
|
||||
string : String → Value
|
||||
number : Scientific → Value
|
||||
bool : Bool → Value
|
||||
null : Value
|
||||
|
||||
Object = KeyMap Value
|
||||
Array = Vector Value
|
||||
|
||||
{-# COMPILE GHC Value = data Data.Aeson.Value (Data.Aeson.Object|Data.Aeson.Array|Data.Aeson.String|Data.Aeson.Number|Data.Aeson.Bool|Data.Aeson.Null) #-}
|
||||
|
||||
postulate decode : ByteString → Maybe Value
|
||||
{-# COMPILE GHC decode = Data.Aeson.decodeStrict #-}
|
||||
|
|
6
prototyping/FFI/Data/Scientific.agda
Normal file
6
prototyping/FFI/Data/Scientific.agda
Normal file
|
@ -0,0 +1,6 @@
|
|||
module FFI.Data.Scientific where
|
||||
|
||||
{-# FOREIGN GHC import qualified Data.Scientific #-}
|
||||
|
||||
postulate Scientific : Set
|
||||
{-# COMPILE GHC Scientific = type Data.Scientific.Scientific #-}
|
7
prototyping/FFI/Data/Vector.agda
Normal file
7
prototyping/FFI/Data/Vector.agda
Normal file
|
@ -0,0 +1,7 @@
|
|||
module FFI.Data.Vector where
|
||||
|
||||
{-# FOREIGN GHC import qualified Data.Vector #-}
|
||||
|
||||
postulate Vector : Set → Set
|
||||
{-# POLARITY Vector ++ #-}
|
||||
{-# COMPILE GHC Vector = type Data.Vector.Vector #-}
|
|
@ -11,7 +11,7 @@ First install Haskell and Agda.
|
|||
Install dependencies:
|
||||
```
|
||||
cabal update
|
||||
cabal install --lib aeson
|
||||
cabal install --lib aeson scientific vector
|
||||
```
|
||||
|
||||
Then compile
|
||||
|
|
Loading…
Add table
Reference in a new issue