Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Aeson quasiquoter for Haskell

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 src
Octocat-spinner-32 .gitignore
Octocat-spinner-32 COPYING.txt
Octocat-spinner-32 README.markdown
Octocat-spinner-32 Setup.hs
Octocat-spinner-32 aeson-qq.cabal
README.markdown

Data.Aeson.QQ

JSON quasiquatation for Haskell.

This package expose the function aesonQQ that compile time converts json code into a Data.Aeson.Value. aesonQQ got the signature

aesonQQ :: QuasiQuoter

and is used like

myCode = [aesonQQ| {age: 23, name: "Pelle", likes: ["mac","Haskell"] } |]

where it is important that

  • you got no space in [aesonQQ| and
  • no additional code after |].

The quasiquatation can also bind to variables like

myCode = [aesonQQ | {age: <| age |>, name: <| name |>} |]
 where age = 34 :: Integer
       name = "Pelle"

or contain Haskell code like

myCode = [aesonQQ | {age: <| age + 42 :: Integer |>, name: <| map toUpper name |>} |]
 where age = 34 :: Integer
       name = "Pelle"
Something went wrong with that request. Please try again.