The fay-simplejson package

[ Tags: bsd3, fay, library, web ] [ Propose Tags ]

SimpleJSON library for Fay.


[Skip to Readme]

Properties

Versions 0.1.1.0, 0.1.3.0
Dependencies fay-base (>=0.18) [details]
License BSD3
Copyright Li Meng Jun
Author Li Meng Jun
Maintainer lmjubuntu@gmail.com
Category Web, Fay
Home page https://github.com/Lupino/fay-simplejson
Bug tracker https://github.com/Lupino/fay-simplejson/issues
Source repository head: git clone https://github.com/Lupino/fay-simplejson.git
Uploaded Sun Oct 30 07:15:11 UTC 2016 by Lupino
Distributions NixOS:0.1.3.0
Downloads 100 total (11 in the last 30 days)
Rating (no votes yet) [estimated by rule of succession]
Your Rating
  • λ
  • λ
  • λ
Status Docs not available [build log]
All reported builds failed as of 2016-11-18 [all 7 reports]
Hackage Matrix CI

Modules

  • SimpleJSON

Downloads

Maintainer's Corner

For package maintainers and hackage trustees


Readme for fay-simplejson-0.1.3.0

[back to package description]

Fay SimpleJSON

SimpleJSON library for Fay.

{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RebindableSyntax  #-}

-- Compile with: fay --package fay-simplejson test.hs --pretty

module Test (main) where

import           Data.Text  (Text, fromString)
import           Prelude
import           SimpleJSON

data Test = Test { xKey :: Text, xValue :: Text }

decoder :: Parser
decoder = withDecoder "Test" [ rawRule "xKey"   "key",
                               rawRule "xValue" "value" ]

encoder :: Parser
encoder = withEncoder [ rawRule "key"   "xKey",
                        rawRule "value" "xValue" ]

main :: Fay ()
main = do
  let test = decode "{\"key\": \"test_key\", \"value\": \"test_value\"}" decoder :: Test
  print test
  print $ encode test encoder

Usage

Install:

cabal install fay-simplejson

Compile your file:

fay --package fay-simplejson MyFile.hs