fay-simplejson: SimpleJSON library for Fay.

[ bsd3, fay, library, web ] [ Propose Tags ] [ Report a vulnerability ]

SimpleJSON library for Fay.


[Skip to Readme]

Modules

[Last Documentation]

  • SimpleJSON

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.1.0, 0.1.3.0
Dependencies fay-base (>=0.18) [details]
License BSD-3-Clause
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 repo head: git clone https://github.com/Lupino/fay-simplejson.git
Uploaded by Lupino at 2016-10-30T07:15:11Z
Distributions
Reverse Dependencies 1 direct, 0 indirect [details]
Downloads 1462 total (0 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs not available [build log]
All reported builds failed as of 2016-11-18 [all 7 reports]

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