git.iko.soy/typeable/servant
on master help sign in
rename servant-jquery to servant-js, Servant.JQuery to Servant.JS
commiteabf13ebdbbd3aecec7deadb79b67922ad8bd02b authorAlp Mestanogullari <alpmestan@gmail.com> dateWed 22 Jul 2015, 12:55 (11 years ago) parent688bc75
30 files changed+48−50
README.md+1−1 scripts/shell.nix+3−3 servant-examples/servant-examples.cabal+1−1 servant-jquery/CHANGELOG.md → servant-js/CHANGELOG.md servant-jquery/LICENSE → servant-js/LICENSE servant-jquery/README.md → servant-js/README.md+1−1 servant-jquery/Setup.hs → servant-js/Setup.hs servant-jquery/TODO.md → servant-js/TODO.md servant-jquery/default.nix → servant-js/default.nix+2−2 servant-jquery/docs.sh → servant-js/docs.sh servant-jquery/examples/README.md → servant-js/examples/README.md servant-jquery/examples/counter.hs → servant-js/examples/counter.hs+6−6 servant-jquery/examples/counter.md → servant-js/examples/counter.md servant-jquery/examples/www/angular/angular.min.js → servant-js/examples/www/angular/angular.min.js servant-jquery/examples/www/angular/index.html → servant-js/examples/www/angular/index.html−1 servant-jquery/examples/www/angular/service.html → servant-js/examples/www/angular/service.html−1 servant-jquery/examples/www/index.html → servant-js/examples/www/index.html servant-jquery/examples/www/jquery/index.html → servant-js/examples/www/jquery/index.html−1 servant-jquery/examples/www/jquery/jquery.min.js → servant-js/examples/www/jquery/jquery.min.js servant-jquery/examples/www/vanilla/index.html → servant-js/examples/www/vanilla/index.html−1 servant-jquery/servant-jquery.cabal → servant-js/servant-js.cabal+11−9 servant-jquery/src/Servant/JQuery.hs → servant-js/src/Servant/JS.hs+3−4 servant-jquery/src/Servant/JQuery/Angular.hs → servant-js/src/Servant/JS/Angular.hs+6−5 servant-jquery/src/Servant/JQuery/Internal.hs → servant-js/src/Servant/JS/Internal.hs+1−1 servant-jquery/src/Servant/JQuery/JQuery.hs → servant-js/src/Servant/JS/JQuery.hs+2−2 servant-jquery/src/Servant/JQuery/Vanilla.hs → servant-js/src/Servant/JS/Vanilla.hs+2−2 servant-jquery/test/Servant/JQuerySpec.hs → servant-js/test/Servant/JSSpec.hs+6−6 servant-jquery/test/Servant/JQuerySpec/CustomHeaders.hs → servant-js/test/Servant/JSSpec/CustomHeaders.hs+2−2 servant-jquery/test/Spec.hs → servant-js/test/Spec.hs sources.txt+1−1
README.md+1−1
@@ -13,7 +13,7 @@ In order to minimize the dependencies depending on your needs, we provide these
1313- `servant-server`, which lets you *implement* an HTTP server with handlers for each endpoint of an API.
1414- `servant-client`, which lets you derive automatically Haskell functions that let you query each endpoint of a `servant` webservice.
1515- `servant-docs`, which lets you generate API docs for your webservice.
16−- `servant-jquery`, which lets you derive Javascript functions (based on jquery) to query your API's endpoints, in the same spirit as `servant-client`.
16+- `servant-js`, which lets you derive Javascript functions (using vanilla JS ajax requests, angular or jquery) to query your API's endpoints, in the same spirit as `servant-client`.
1717- `servant-blaze` and `servant-lucid` provide easy HTML rendering of your data as an `HTML` content-type "combinator".
1818
1919## Tutorial
scripts/shell.nix+3−3
@@ -9,12 +9,12 @@ let modifiedHaskellPackages = haskellngPackages.override {
99 ../servant-server {}) "--ghc-options=-Werror";
1010 servant-client = appendConfigureFlag (self.callPackage
1111 ../servant-client {}) "--ghc-options=-Werror";
12− servant-jquery = appendConfigureFlag (self.callPackage
13− ../servant-jquery {}) "--ghc-options=-Werror";
12+ servant-js = appendConfigureFlag (self.callPackage
13+ ../servant-js {}) "--ghc-options=-Werror";
1414 servant-docs = appendConfigureFlag (self.callPackage ../servant-docs
1515 {}) "--ghc-options=-Werror";
1616 };
1717 };
1818in modifiedHaskellPackages.ghcWithPackages ( p : with p ; [
19− servant servant-server servant-client servant-jquery servant-docs
19+ servant servant-server servant-client servant-js servant-docs
2020])
servant-examples/servant-examples.cabal+1−1
@@ -32,7 +32,7 @@ executable tutorial
3232 , random
3333 , servant == 0.4.*
3434 , servant-docs == 0.4.*
35− , servant-jquery == 0.4.*
35+ , servant-js == 0.4.*
3636 , servant-lucid == 0.4.*
3737 , servant-server == 0.4.*
3838 , text
servant-jquery/CHANGELOG.md → servant-js/CHANGELOG.mdrenamed

The content is the same.

servant-jquery/LICENSE → servant-js/LICENSErenamed

The content is the same.

servant-jquery/README.md → servant-js/README.mdrenamed+1−1
@@ -1,4 +1,4 @@
1−# servant-jquery
1+# servant-js
22
33![servant](https://raw.githubusercontent.com/haskell-servant/servant/master/servant.png)
44
servant-jquery/Setup.hs → servant-js/Setup.hsrenamed

The content is the same.

servant-jquery/TODO.md → servant-js/TODO.mdrenamed

The content is the same.

servant-jquery/default.nix → servant-js/default.nixrenamed+2−2
@@ -3,7 +3,7 @@
33, servant-server, stdenv, stm, text, transformers, warp
44}:
55mkDerivation {
6− pname = "servant-jquery";
6+ pname = "servant-js";
77 version = "0.4.0";
88 src = ./.;
99 isLibrary = true;
@@ -16,6 +16,6 @@ mkDerivation {
1616 base hspec hspec-expectations language-ecmascript lens servant
1717 ];
1818 homepage = "http://haskell-servant.github.io/";
19− description = "Automatically derive (jquery) javascript functions to query servant webservices";
19+ description = "Automatically derive javascript functions to query servant webservices";
2020 license = stdenv.lib.licenses.bsd3;
2121}
servant-jquery/docs.sh → servant-js/docs.shrenamed

The content is the same.

servant-jquery/examples/README.md → servant-js/examples/README.mdrenamed

The content is the same.

servant-jquery/examples/counter.hs → servant-js/examples/counter.hsrenamed+6−6
@@ -10,11 +10,11 @@ import Data.Proxy
1010import GHC.Generics
1111import Network.Wai.Handler.Warp (run)
1212import Servant
13−import Servant.JQuery
14−import qualified Servant.JQuery as SJQ
15−import qualified Servant.JQuery.Vanilla as JS
16−import qualified Servant.JQuery.JQuery as JQ
17−import qualified Servant.JQuery.Angular as NG
13+import Servant.JS
14+import qualified Servant.JS as SJS
15+import qualified Servant.JS.Vanilla as JS
16+import qualified Servant.JS.JQuery as JQ
17+import qualified Servant.JS.Angular as NG
1818import System.FilePath
1919
2020-- * A simple Counter data type
@@ -77,7 +77,7 @@ writeJS gen fp functions = writeFile fp $
7777writeServiceJS :: FilePath -> [AjaxReq] -> IO ()
7878writeServiceJS fp functions = writeFile fp $
7979 NG.wrapInServiceWith (NG.defAngularOptions { NG.serviceName = "counterSvc" })
80− (defCommonGeneratorOptions { SJQ.moduleName = "counterApp" }) functions
80+ (defCommonGeneratorOptions { SJS.moduleName = "counterApp" }) functions
8181
8282main :: IO ()
8383main = do
servant-jquery/examples/counter.md → servant-js/examples/counter.mdrenamed

The content is the same.

servant-jquery/examples/www/angular/angular.min.js → servant-js/examples/www/angular/angular.min.jsrenamed

The content is the same.

servant-jquery/examples/www/angular/index.html → servant-js/examples/www/angular/index.htmlrenamed−1
@@ -13,7 +13,6 @@
1313<h1>Angular version</h1>
1414<span id="counter">{{ 'Counter: ' + counter }}</span>
1515<button ng-click="incCounter()" id="inc">Increase</button>
16−or <a href="/doc">view the docs</a>
1716<script type="text/javascript">
1817var counterApp = angular.module('counterApp', []);
1918
servant-jquery/examples/www/angular/service.html → servant-js/examples/www/angular/service.htmlrenamed−1
@@ -12,7 +12,6 @@
1212<h1>Angular version (Service version)</h1>
1313<span id="counter">{{ 'Counter: ' + counter }}</span>
1414<button ng-click="incCounter()" id="inc">Increase</button>
15−or <a href="/doc">view the docs</a>
1615<script type="text/javascript">
1716var counterApp = angular.module('counterApp', []);
1817
servant-jquery/examples/www/index.html → servant-js/examples/www/index.htmlrenamed

The content is the same.

servant-jquery/examples/www/jquery/index.html → servant-js/examples/www/jquery/index.htmlrenamed−1
@@ -11,7 +11,6 @@
1111<h1>JQuery version</h1>
1212<span id="counter">Counter: 0</span>
1313<button id="inc">Increase</button>
14−or <a href="/doc">view the docs</a>
1514
1615<script src="jquery.min.js" type="text/javascript"></script>
1716<script src="api.js" type="text/javascript"></script>
servant-jquery/examples/www/jquery/jquery.min.js → servant-js/examples/www/jquery/jquery.min.jsrenamed

The content is the same.

servant-jquery/examples/www/vanilla/index.html → servant-js/examples/www/vanilla/index.htmlrenamed−1
@@ -11,7 +11,6 @@
1111<h1>Vanilla version</h1>
1212<span id="counter">Counter: 0</span>
1313<button id="inc">Increase</button>
14−or <a href="/doc">view the docs</a>
1514
1615<script src="api.js" type="text/javascript"></script>
1716<script type="text/javascript">
servant-jquery/servant-jquery.cabal → servant-js/servant-js.cabalrenamed+11−9
@@ -1,9 +1,11 @@
1−name: servant-jquery
1+name: servant-js
22version: 0.4.1
3−synopsis: Automatically derive (jquery) javascript functions to query servant webservices
3+synopsis: Automatically derive javascript functions to query servant webservices.
44description:
55 Automatically derive jquery-based javascript functions to query servant webservices.
66 .
7+ Supports deriving functions using vanilla javascript AJAX requests, Angular or JQuery.
8+ .
79 You can find an example <https://github.com/haskell-servant/servant/blob/master/servant-jquery/examples/counter.hs here>
810 which serves the generated javascript to a webpage that allows you to trigger
911 webservice calls.
@@ -32,11 +34,11 @@ flag example
3234 default: False
3335
3436library
35− exposed-modules: Servant.JQuery
36− Servant.JQuery.Angular
37− Servant.JQuery.JQuery
38− Servant.JQuery.Vanilla
39− other-modules: Servant.JQuery.Internal
37+ exposed-modules: Servant.JS
38+ Servant.JS.Angular
39+ Servant.JS.JQuery
40+ Servant.JS.Vanilla
41+ other-modules: Servant.JS.Internal
4042 build-depends: base >=4.5 && <5
4143 , charset
4244 , lens >= 4
@@ -62,7 +64,7 @@ executable counter
6264 , filepath
6365 , servant == 0.4.*
6466 , servant-server == 0.4.*
65− , servant-jquery == 0.4.*
67+ , servant-js == 0.4.*
6668 , stm
6769 , transformers
6870 , warp
@@ -76,7 +78,7 @@ test-suite spec
7678 build-depends:
7779 base == 4.*
7880 , lens
79− , servant-jquery
81+ , servant-js
8082 , servant
8183 , hspec >= 2.0
8284 , hspec-expectations
servant-jquery/src/Servant/JQuery.hs → servant-js/src/Servant/JS.hsrenamed+3−4
@@ -5,25 +5,24 @@
55-----------------------------------------------------------------------------
66-- |
77-- Module : Servant.JQuery
8−-- Copyright : (C) 2014 Alp Mestanogullari
98-- License : BSD3
109-- Maintainer : Alp Mestanogullari <alpmestan@gmail.com>
1110-- Stability : experimental
1211-- Portability : non-portable
13−module Servant.JQuery
12+module Servant.JS
1413 ( javascript
1514 , generateJS
1615 , jsForAPI
1716 , listFromAPI
1817 , printJS
19− , module Servant.JQuery.Internal
18+ , module Servant.JS.Internal
2019 , GenerateCode(..)
2120 , CommonGeneratorOptions(..)
2221 ) where
2322
2423import Data.Proxy
2524import Servant.API
26−import Servant.JQuery.Internal
25+import Servant.JS.Internal
2726
2827javascript :: HasJS layout => Proxy layout -> JS layout
2928javascript p = javascriptFor p defReq
servant-jquery/src/Servant/JQuery/Angular.hs → servant-js/src/Servant/JS/Angular.hsrenamed+6−5
@@ -1,17 +1,18 @@
1−module Servant.JQuery.Angular where
1+module Servant.JS.Angular where
22
3−import Servant.JQuery.Internal
3+import Servant.JS.Internal
44import Control.Lens
55import Data.List
66import Data.Monoid
77
88data AngularOptions = AngularOptions
99 { serviceName :: String -- ^ When generating code with wrapInService,
10− -- ^ name of the service to generate
10+ -- name of the service to generate
1111 , prologue :: String -> String -> String -- ^ beginning of the service definition
1212 , epilogue :: String -- ^ end of the service definition
1313 }
1414
15+-- | Default options for the Angular codegen. Used by 'wrapInService'.
1516defAngularOptions :: AngularOptions
1617defAngularOptions = AngularOptions
1718 { serviceName = ""
@@ -21,8 +22,8 @@ defAngularOptions = AngularOptions
2122 }
2223
2324-- | Instead of simply generating top level functions, generates a service instance
24−-- on which your controllers can depend to access your API
25−-- This variant uses default AngularOptions
25+-- on which your controllers can depend to access your API.
26+-- This variant uses default 'AngularOptions'.
2627wrapInService :: AngularOptions -> [AjaxReq] -> String
2728wrapInService ngOpts reqs = wrapInServiceWith ngOpts defCommonGeneratorOptions reqs
2829
servant-jquery/src/Servant/JQuery/Internal.hs → servant-js/src/Servant/JS/Internal.hsrenamed+1−1
@@ -8,7 +8,7 @@
88{-# LANGUAGE TypeFamilies #-}
99{-# LANGUAGE TypeOperators #-}
1010{-# LANGUAGE UndecidableInstances #-}
11−module Servant.JQuery.Internal where
11+module Servant.JS.Internal where
1212
1313#if !MIN_VERSION_base(4,8,0)
1414import Control.Applicative
servant-jquery/src/Servant/JQuery/JQuery.hs → servant-js/src/Servant/JS/JQuery.hsrenamed+2−2
@@ -1,6 +1,6 @@
1−module Servant.JQuery.JQuery where
1+module Servant.JS.JQuery where
22
3−import Servant.JQuery.Internal
3+import Servant.JS.Internal
44import Control.Lens
55import Data.List
66import Data.Monoid
servant-jquery/src/Servant/JQuery/Vanilla.hs → servant-js/src/Servant/JS/Vanilla.hsrenamed+2−2
@@ -1,6 +1,6 @@
1−module Servant.JQuery.Vanilla where
1+module Servant.JS.Vanilla where
22
3−import Servant.JQuery.Internal
3+import Servant.JS.Internal
44import Control.Lens
55import Data.List
66import Data.Monoid
servant-jquery/test/Servant/JQuerySpec.hs → servant-js/test/Servant/JSSpec.hsrenamed+6−6
@@ -5,7 +5,7 @@
55{-# LANGUAGE TypeFamilies #-}
66{-# LANGUAGE TypeOperators #-}
77{-# OPTIONS_GHC -fno-warn-orphans #-}
8−module Servant.JQuerySpec where
8+module Servant.JSSpec where
99
1010import Data.Either (isRight)
1111import Data.Proxy
@@ -13,11 +13,11 @@ import Language.ECMAScript3.Parser (parseFromString)
1313import Test.Hspec
1414
1515import Servant.API
16−import Servant.JQuery
17−import qualified Servant.JQuery.Vanilla as JS
18−import qualified Servant.JQuery.JQuery as JQ
19−import qualified Servant.JQuery.Angular as NG
20−import Servant.JQuerySpec.CustomHeaders
16+import Servant.JS
17+import qualified Servant.JS.Vanilla as JS
18+import qualified Servant.JS.JQuery as JQ
19+import qualified Servant.JS.Angular as NG
20+import Servant.JSSpec.CustomHeaders
2121
2222type TestAPI = "simple" :> ReqBody '[JSON,FormUrlEncoded] String :> Post '[JSON] Bool
2323 :<|> "has.extension" :> Get '[FormUrlEncoded,JSON] Bool
servant-jquery/test/Servant/JQuerySpec/CustomHeaders.hs → servant-js/test/Servant/JSSpec/CustomHeaders.hsrenamed+2−2
@@ -6,14 +6,14 @@
66{-# LANGUAGE TypeFamilies #-}
77{-# LANGUAGE TypeOperators #-}
88
9−module Servant.JQuerySpec.CustomHeaders where
9+module Servant.JSSpec.CustomHeaders where
1010
1111import Control.Lens
1212import Data.Monoid
1313import Data.Proxy
1414import GHC.TypeLits
1515import Servant.API
16−import Servant.JQuery
16+import Servant.JS
1717
1818-- | This is a hypothetical combinator that fetches an Authorization header.
1919-- The symbol in the header denotes what kind of authentication we are
servant-jquery/test/Spec.hs → servant-js/test/Spec.hsrenamed

The content is the same.

sources.txt+1−1
@@ -1,7 +1,7 @@
11servant
22servant-client
33servant-docs
4−servant-jquery
4+servant-js
55servant-server
66servant-examples
77servant-blaze