mirror of
https://github.com/luau-lang/luau.git
synced 2025-05-04 10:33:46 +01:00
23 lines
749 B
Agda
23 lines
749 B
Agda
module FFI.Data.Aeson where
|
|
|
|
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)
|
|
|
|
{-# FOREIGN GHC import qualified Data.Aeson #-}
|
|
|
|
postulate Value : Set
|
|
{-# COMPILE GHC Value = type Data.Aeson.Value #-}
|
|
|
|
postulate decode : ByteString → Maybe Value
|
|
{-# COMPILE GHC decode = Data.Aeson.decodeStrict #-}
|
|
|
|
postulate eitherHDecode : ByteString → Either HaskellString Value
|
|
{-# COMPILE GHC eitherHDecode = Data.Aeson.eitherDecodeStrict #-}
|
|
|
|
eitherDecode : ByteString → Either String Value
|
|
eitherDecode bytes = mapLeft pack (eitherHDecode bytes)
|
|
|