on master help sign in
rename servant-jquery to servant-js, Servant.JQuery to Servant.JS
eabf13eAlp Mestanogullari
README.md+1−1
@@ -13,7 +13,7 @@ In order to minimize the dependencies depending on your needs, we provide these
13- `servant-server`, which lets you *implement* an HTTP server with handlers for each endpoint of an API.
13- `servant-server`, which lets you *implement* an HTTP server with handlers for each endpoint of an API.
14- `servant-client`, which lets you derive automatically Haskell functions that let you query each endpoint of a `servant` webservice.
14- `servant-client`, which lets you derive automatically Haskell functions that let you query each endpoint of a `servant` webservice.
15- `servant-docs`, which lets you generate API docs for your webservice.
15- `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`.
17- `servant-blaze` and `servant-lucid` provide easy HTML rendering of your data as an `HTML` content-type "combinator".
17- `servant-blaze` and `servant-lucid` provide easy HTML rendering of your data as an `HTML` content-type "combinator".
18
18
19## Tutorial
19## Tutorial
scripts/shell.nix+3−3
@@ -9,12 +9,12 @@ let modifiedHaskellPackages = haskellngPackages.override {
9 ../servant-server {}) "--ghc-options=-Werror";
9 ../servant-server {}) "--ghc-options=-Werror";
10 servant-client = appendConfigureFlag (self.callPackage
10 servant-client = appendConfigureFlag (self.callPackage
11 ../servant-client {}) "--ghc-options=-Werror";
11 ../servant-client {}) "--ghc-options=-Werror";
12− servant-jquery = appendConfigureFlag (self.callPackage
12+ servant-js = appendConfigureFlag (self.callPackage
13− ../servant-jquery {}) "--ghc-options=-Werror";
13+ ../servant-js {}) "--ghc-options=-Werror";
14 servant-docs = appendConfigureFlag (self.callPackage ../servant-docs
14 servant-docs = appendConfigureFlag (self.callPackage ../servant-docs
15 {}) "--ghc-options=-Werror";
15 {}) "--ghc-options=-Werror";
16 };
16 };
17 };
17 };
18in modifiedHaskellPackages.ghcWithPackages ( p : with p ; [
18in 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
20])
20])
servant-examples/servant-examples.cabal+1−1
@@ -32,7 +32,7 @@ executable tutorial
32 , random
32 , random
33 , servant == 0.4.*
33 , servant == 0.4.*
34 , servant-docs == 0.4.*
34 , servant-docs == 0.4.*
35− , servant-jquery == 0.4.*
35+ , servant-js == 0.4.*
36 , servant-lucid == 0.4.*
36 , servant-lucid == 0.4.*
37 , servant-server == 0.4.*
37 , servant-server == 0.4.*
38 , text
38 , 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
2
2
3![servant](https://raw.githubusercontent.com/haskell-servant/servant/master/servant.png)
3![servant](https://raw.githubusercontent.com/haskell-servant/servant/master/servant.png)
4
4
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 @@
3, servant-server, stdenv, stm, text, transformers, warp
3, servant-server, stdenv, stm, text, transformers, warp
4}:
4}:
5mkDerivation {
5mkDerivation {
6− pname = "servant-jquery";
6+ pname = "servant-js";
7 version = "0.4.0";
7 version = "0.4.0";
8 src = ./.;
8 src = ./.;
9 isLibrary = true;
9 isLibrary = true;
@@ -16,6 +16,6 @@ mkDerivation {
16 base hspec hspec-expectations language-ecmascript lens servant
16 base hspec hspec-expectations language-ecmascript lens servant
17 ];
17 ];
18 homepage = "http://haskell-servant.github.io/";
18 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";
20 license = stdenv.lib.licenses.bsd3;
20 license = stdenv.lib.licenses.bsd3;
21}
21}
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
10import GHC.Generics
10import GHC.Generics
11import Network.Wai.Handler.Warp (run)
11import Network.Wai.Handler.Warp (run)
12import Servant
12import Servant
13−import Servant.JQuery
13+import Servant.JS
14−import qualified Servant.JQuery as SJQ
14+import qualified Servant.JS as SJS
15−import qualified Servant.JQuery.Vanilla as JS
15+import qualified Servant.JS.Vanilla as JS
16−import qualified Servant.JQuery.JQuery as JQ
16+import qualified Servant.JS.JQuery as JQ
17−import qualified Servant.JQuery.Angular as NG
17+import qualified Servant.JS.Angular as NG
18import System.FilePath
18import System.FilePath
19
19
20-- * A simple Counter data type
20-- * A simple Counter data type
@@ -77,7 +77,7 @@ writeJS gen fp functions = writeFile fp $
77writeServiceJS :: FilePath -> [AjaxReq] -> IO ()
77writeServiceJS :: FilePath -> [AjaxReq] -> IO ()
78writeServiceJS fp functions = writeFile fp $
78writeServiceJS fp functions = writeFile fp $
79 NG.wrapInServiceWith (NG.defAngularOptions { NG.serviceName = "counterSvc" })
79 NG.wrapInServiceWith (NG.defAngularOptions { NG.serviceName = "counterSvc" })
80− (defCommonGeneratorOptions { SJQ.moduleName = "counterApp" }) functions
80+ (defCommonGeneratorOptions { SJS.moduleName = "counterApp" }) functions
81
81
82main :: IO ()
82main :: IO ()
83main = do
83main = 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 @@
13<h1>Angular version</h1>
13<h1>Angular version</h1>
14<span id="counter">{{ 'Counter: ' + counter }}</span>
14<span id="counter">{{ 'Counter: ' + counter }}</span>
15<button ng-click="incCounter()" id="inc">Increase</button>
15<button ng-click="incCounter()" id="inc">Increase</button>
16−or <a href="/doc">view the docs</a>
17<script type="text/javascript">
16<script type="text/javascript">
18var counterApp = angular.module('counterApp', []);
17var counterApp = angular.module('counterApp', []);
19
18
servant-jquery/examples/www/angular/service.html → servant-js/examples/www/angular/service.htmlrenamed−1
@@ -12,7 +12,6 @@
12<h1>Angular version (Service version)</h1>
12<h1>Angular version (Service version)</h1>
13<span id="counter">{{ 'Counter: ' + counter }}</span>
13<span id="counter">{{ 'Counter: ' + counter }}</span>
14<button ng-click="incCounter()" id="inc">Increase</button>
14<button ng-click="incCounter()" id="inc">Increase</button>
15−or <a href="/doc">view the docs</a>
16<script type="text/javascript">
15<script type="text/javascript">
17var counterApp = angular.module('counterApp', []);
16var counterApp = angular.module('counterApp', []);
18
17
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 @@
11<h1>JQuery version</h1>
11<h1>JQuery version</h1>
12<span id="counter">Counter: 0</span>
12<span id="counter">Counter: 0</span>
13<button id="inc">Increase</button>
13<button id="inc">Increase</button>
14−or <a href="/doc">view the docs</a>
15
14
16<script src="jquery.min.js" type="text/javascript"></script>
15<script src="jquery.min.js" type="text/javascript"></script>
17<script src="api.js" type="text/javascript"></script>
16<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 @@
11<h1>Vanilla version</h1>
11<h1>Vanilla version</h1>
12<span id="counter">Counter: 0</span>
12<span id="counter">Counter: 0</span>
13<button id="inc">Increase</button>
13<button id="inc">Increase</button>
14−or <a href="/doc">view the docs</a>
15
14
16<script src="api.js" type="text/javascript"></script>
15<script src="api.js" type="text/javascript"></script>
17<script type="text/javascript">
16<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
2version: 0.4.1
2version: 0.4.1
3−synopsis: Automatically derive (jquery) javascript functions to query servant webservices
3+synopsis: Automatically derive javascript functions to query servant webservices.
4description:
4description:
5 Automatically derive jquery-based javascript functions to query servant webservices.
5 Automatically derive jquery-based javascript functions to query servant webservices.
6 .
6 .
7+ Supports deriving functions using vanilla javascript AJAX requests, Angular or JQuery.
8+ .
7 You can find an example <https://github.com/haskell-servant/servant/blob/master/servant-jquery/examples/counter.hs here>
9 You can find an example <https://github.com/haskell-servant/servant/blob/master/servant-jquery/examples/counter.hs here>
8 which serves the generated javascript to a webpage that allows you to trigger
10 which serves the generated javascript to a webpage that allows you to trigger
9 webservice calls.
11 webservice calls.
@@ -32,11 +34,11 @@ flag example
32 default: False
34 default: False
33
35
34library
36library
35− exposed-modules: Servant.JQuery
37+ exposed-modules: Servant.JS
36− Servant.JQuery.Angular
38+ Servant.JS.Angular
37− Servant.JQuery.JQuery
39+ Servant.JS.JQuery
38− Servant.JQuery.Vanilla
40+ Servant.JS.Vanilla
39− other-modules: Servant.JQuery.Internal
41+ other-modules: Servant.JS.Internal
40 build-depends: base >=4.5 && <5
42 build-depends: base >=4.5 && <5
41 , charset
43 , charset
42 , lens >= 4
44 , lens >= 4
@@ -62,7 +64,7 @@ executable counter
62 , filepath
64 , filepath
63 , servant == 0.4.*
65 , servant == 0.4.*
64 , servant-server == 0.4.*
66 , servant-server == 0.4.*
65− , servant-jquery == 0.4.*
67+ , servant-js == 0.4.*
66 , stm
68 , stm
67 , transformers
69 , transformers
68 , warp
70 , warp
@@ -76,7 +78,7 @@ test-suite spec
76 build-depends:
78 build-depends:
77 base == 4.*
79 base == 4.*
78 , lens
80 , lens
79− , servant-jquery
81+ , servant-js
80 , servant
82 , servant
81 , hspec >= 2.0
83 , hspec >= 2.0
82 , hspec-expectations
84 , hspec-expectations
servant-jquery/src/Servant/JQuery.hs → servant-js/src/Servant/JS.hsrenamed+3−4
@@ -5,25 +5,24 @@
5-----------------------------------------------------------------------------
5-----------------------------------------------------------------------------
6-- |
6-- |
7-- Module : Servant.JQuery
7-- Module : Servant.JQuery
8−-- Copyright : (C) 2014 Alp Mestanogullari
9-- License : BSD3
8-- License : BSD3
10-- Maintainer : Alp Mestanogullari <alpmestan@gmail.com>
9-- Maintainer : Alp Mestanogullari <alpmestan@gmail.com>
11-- Stability : experimental
10-- Stability : experimental
12-- Portability : non-portable
11-- Portability : non-portable
13−module Servant.JQuery
12+module Servant.JS
14 ( javascript
13 ( javascript
15 , generateJS
14 , generateJS
16 , jsForAPI
15 , jsForAPI
17 , listFromAPI
16 , listFromAPI
18 , printJS
17 , printJS
19− , module Servant.JQuery.Internal
18+ , module Servant.JS.Internal
20 , GenerateCode(..)
19 , GenerateCode(..)
21 , CommonGeneratorOptions(..)
20 , CommonGeneratorOptions(..)
22 ) where
21 ) where
23
22
24import Data.Proxy
23import Data.Proxy
25import Servant.API
24import Servant.API
26−import Servant.JQuery.Internal
25+import Servant.JS.Internal
27
26
28javascript :: HasJS layout => Proxy layout -> JS layout
27javascript :: HasJS layout => Proxy layout -> JS layout
29javascript p = javascriptFor p defReq
28javascript 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
2
2
3−import Servant.JQuery.Internal
3+import Servant.JS.Internal
4import Control.Lens
4import Control.Lens
5import Data.List
5import Data.List
6import Data.Monoid
6import Data.Monoid
7
7
8data AngularOptions = AngularOptions
8data AngularOptions = AngularOptions
9 { serviceName :: String -- ^ When generating code with wrapInService,
9 { serviceName :: String -- ^ When generating code with wrapInService,
10− -- ^ name of the service to generate
10+ -- name of the service to generate
11 , prologue :: String -> String -> String -- ^ beginning of the service definition
11 , prologue :: String -> String -> String -- ^ beginning of the service definition
12 , epilogue :: String -- ^ end of the service definition
12 , epilogue :: String -- ^ end of the service definition
13 }
13 }
14
14
15+-- | Default options for the Angular codegen. Used by 'wrapInService'.
15defAngularOptions :: AngularOptions
16defAngularOptions :: AngularOptions
16defAngularOptions = AngularOptions
17defAngularOptions = AngularOptions
17 { serviceName = ""
18 { serviceName = ""
@@ -21,8 +22,8 @@ defAngularOptions = AngularOptions
21 }
22 }
22
23
23-- | Instead of simply generating top level functions, generates a service instance
24-- | Instead of simply generating top level functions, generates a service instance
24−-- on which your controllers can depend to access your API
25+-- on which your controllers can depend to access your API.
25−-- This variant uses default AngularOptions
26+-- This variant uses default 'AngularOptions'.
26wrapInService :: AngularOptions -> [AjaxReq] -> String
27wrapInService :: AngularOptions -> [AjaxReq] -> String
27wrapInService ngOpts reqs = wrapInServiceWith ngOpts defCommonGeneratorOptions reqs
28wrapInService ngOpts reqs = wrapInServiceWith ngOpts defCommonGeneratorOptions reqs
28
29
servant-jquery/src/Servant/JQuery/Internal.hs → servant-js/src/Servant/JS/Internal.hsrenamed+1−1
@@ -8,7 +8,7 @@
8{-# LANGUAGE TypeFamilies #-}
8{-# LANGUAGE TypeFamilies #-}
9{-# LANGUAGE TypeOperators #-}
9{-# LANGUAGE TypeOperators #-}
10{-# LANGUAGE UndecidableInstances #-}
10{-# LANGUAGE UndecidableInstances #-}
11−module Servant.JQuery.Internal where
11+module Servant.JS.Internal where
12
12
13#if !MIN_VERSION_base(4,8,0)
13#if !MIN_VERSION_base(4,8,0)
14import Control.Applicative
14import 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
2
2
3−import Servant.JQuery.Internal
3+import Servant.JS.Internal
4import Control.Lens
4import Control.Lens
5import Data.List
5import Data.List
6import Data.Monoid
6import 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
2
2
3−import Servant.JQuery.Internal
3+import Servant.JS.Internal
4import Control.Lens
4import Control.Lens
5import Data.List
5import Data.List
6import Data.Monoid
6import Data.Monoid
servant-jquery/test/Servant/JQuerySpec.hs → servant-js/test/Servant/JSSpec.hsrenamed+6−6
@@ -5,7 +5,7 @@
5{-# LANGUAGE TypeFamilies #-}
5{-# LANGUAGE TypeFamilies #-}
6{-# LANGUAGE TypeOperators #-}
6{-# LANGUAGE TypeOperators #-}
7{-# OPTIONS_GHC -fno-warn-orphans #-}
7{-# OPTIONS_GHC -fno-warn-orphans #-}
8−module Servant.JQuerySpec where
8+module Servant.JSSpec where
9
9
10import Data.Either (isRight)
10import Data.Either (isRight)
11import Data.Proxy
11import Data.Proxy
@@ -13,11 +13,11 @@ import Language.ECMAScript3.Parser (parseFromString)
13import Test.Hspec
13import Test.Hspec
14
14
15import Servant.API
15import Servant.API
16−import Servant.JQuery
16+import Servant.JS
17−import qualified Servant.JQuery.Vanilla as JS
17+import qualified Servant.JS.Vanilla as JS
18−import qualified Servant.JQuery.JQuery as JQ
18+import qualified Servant.JS.JQuery as JQ
19−import qualified Servant.JQuery.Angular as NG
19+import qualified Servant.JS.Angular as NG
20−import Servant.JQuerySpec.CustomHeaders
20+import Servant.JSSpec.CustomHeaders
21
21
22type TestAPI = "simple" :> ReqBody '[JSON,FormUrlEncoded] String :> Post '[JSON] Bool
22type TestAPI = "simple" :> ReqBody '[JSON,FormUrlEncoded] String :> Post '[JSON] Bool
23 :<|> "has.extension" :> Get '[FormUrlEncoded,JSON] Bool
23 :<|> "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 @@
6{-# LANGUAGE TypeFamilies #-}
6{-# LANGUAGE TypeFamilies #-}
7{-# LANGUAGE TypeOperators #-}
7{-# LANGUAGE TypeOperators #-}
8
8
9−module Servant.JQuerySpec.CustomHeaders where
9+module Servant.JSSpec.CustomHeaders where
10
10
11import Control.Lens
11import Control.Lens
12import Data.Monoid
12import Data.Monoid
13import Data.Proxy
13import Data.Proxy
14import GHC.TypeLits
14import GHC.TypeLits
15import Servant.API
15import Servant.API
16−import Servant.JQuery
16+import Servant.JS
17
17
18-- | This is a hypothetical combinator that fetches an Authorization header.
18-- | This is a hypothetical combinator that fetches an Authorization header.
19-- The symbol in the header denotes what kind of authentication we are
19-- 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 @@
1servant
1servant
2servant-client
2servant-client
3servant-docs
3servant-docs
4−servant-jquery
4+servant-js
5servant-server
5servant-server
6servant-examples
6servant-examples
7servant-blaze
7servant-blaze