on master help sign in
Reorganize testserver, update all deps to 'improved-base'
commit6e33745d1c4c6c3ba0a8f7dfc68b4ad63445ae7f authorGreg Hale <imalsogreg@gmail.com> dateSun 7 Feb 2016, 16:46 (11 years ago) parent11e01e7
20 files changed+18−117
.gitmodules+3 deps/reflex+1 deps/reflex-dom+1−1 deps/try-reflex+1−1 exec/API.hs+1−1 exec/Example.hs−1 init-sandbox.sh+2−2 servant-reflex.cabal+2−3 src/Servant/Reflex.hs+6−6 test/back/API.hs−1 test/common/API.hs−8 test/front/API.hs−1 test/front/LICENSE−30 test/front/Main.hs−28 test/front/default.nix−10 test/front/front.cabal−24 testserver/API.hs+1 test/back/LICENSE → testserver/LICENSE test/back/Main.hs → testserver/Main.hs test/back/back.cabal → testserver/back.cabal
.gitmodules+3
@@ -13,3 +13,6 @@
1313[submodule "deps/reflex-dom"]
1414 path = deps/reflex-dom
1515 url = https://github.com/ryantrinkle/reflex-dom
16+[submodule "deps/reflex"]
17+ path = deps/reflex
18+ url = https://github.com/ryantrinkle/reflex
deps/reflexnew file+1

Submodule changed.

deps/reflex-dom+1−1

Submodule changed.

deps/try-reflex+1−1

Submodule changed.

exec/API.hs+1−1
@@ -5,4 +5,4 @@ module API where
55
66import Servant.API
77
8−type API = Get '[JSON] ()
8+type API = Get '[JSON] () :<|> Get '[JSON] Int
exec/Example.hs−1
@@ -7,7 +7,6 @@ import Servant.Reflex
77import API
88import Data.Proxy
99import Reflex.Dom
10−import Reflex.Dom.Contrib.Xhr
1110
1211api :: Proxy API
1312api = Proxy
init-sandbox.sh+2−2
@@ -31,10 +31,10 @@ cabal sandbox add-source deps/servant-snap/deps/servant/servant-lucid
3131cabal sandbox add-source deps/servant-snap/deps/servant/servant-mock
3232
3333cabal sandbox add-source deps/servant-snap
34+cabal sandbox add-source deps/reflex
3435cabal sandbox add-source deps/reflex-dom
3536cabal sandbox add-source deps/reflex-dom-contrib
3637
3738cabal sandbox add-source .
3839
39−cd test/front && cabal sandbox init --sandbox=../../.cabal-sandbox && cd ../..
40−cd test/back && cabal sandbox init --sandbox=../../.cabal-sandbox && cd ../..
40+cd testserver && cabal sandbox init --sandbox=../.cabal-sandbox && cd ..
servant-reflex.cabal+2−3
@@ -27,7 +27,7 @@ library
2727 data-default >= 0.5 && < 0.6,
2828 exceptions >= 0.8 && < 0.9,
2929 ghcjs-base,
30− ghcjs-dom == 0.1.*,
30+ ghcjs-dom >= 0.2 && < 0.3,
3131 http-api-data >= 0.2 && < 0.3,
3232 http-media >= 0.6 && < 0.7,
3333 http-types >= 0.8 && < 0.9,
@@ -35,7 +35,6 @@ library
3535 network-uri >= 2.6 && < 2.7,
3636 reflex,
3737 reflex-dom,
38− reflex-dom-contrib,
3938 safe,
4039 servant >= 0.5 && < 0.6,
4140 string-conversions,
@@ -48,7 +47,7 @@ library
4847 ghc-options: -threaded -Wall -fwarn-tabs -funbox-strict-fields -O2
4948
5049executable example
51− build-depends: reflex, servant-reflex, base, servant, reflex-dom, reflex-dom-contrib
50+ build-depends: reflex, servant-reflex, base, servant, reflex-dom
5251 default-language: Haskell2010
5352 main-is: Example.hs
5453 other-modules: API
src/Servant/Reflex.hs+6−6
@@ -26,6 +26,7 @@ module Servant.Reflex
2626import Control.Applicative ((<$>))
2727#endif
2828import Control.Monad
29+import Control.Monad.Trans (liftIO)
2930import Control.Monad.Trans.Except
3031import Data.ByteString.Lazy (ByteString)
3132import Data.Default
@@ -43,7 +44,6 @@ import Servant.Common.Req
4344import Reflex
4445import Reflex.Dom
4546import Web.HttpApiData
46−import Reflex.Dom.Contrib.Xhr
4747import Reflex.Dom.Xhr
4848
4949-- * Accessing APIs as a Client
@@ -94,11 +94,11 @@ instance
9494#endif
9595 (MimeUnrender ct result) => HasReflexClient (Get (ct ': cts) result) where
9696 type Input (Get (ct ': cts) result) = ()
97− type Output (Get (ct' : cts) result) = result
98− clientWithRoute Proxy req baseurl trigEvents = performAJAX requestBuilder responseParser
99− where
100− requestBuilder _ = XhrRequest "GET" (showBaseUrl baseurl) def
101− responseParser xhrResp =
97+ type Output (Get (ct ': cts) result) = result
98+ clientWithRoute Proxy req baseurl trigEvents = undefined -- performAJAX requestBuilder responseParser
99+-- where
100+-- requestBuilder _ = XhrRequest "GET" (showBaseUrl baseurl) def
101+-- responseParser xhrResp = undefined
102102
103103performAJAX
104104 :: (MonadWidget t m)
test/back/API.hsdeleted−1
@@ -1 +0,0 @@
1−../common/API.hs
test/common/API.hsdeleted−8
@@ -1,8 +0,0 @@
1−{-# LANGUAGE DataKinds #-}
2−{-# LANGUAGE TypeOperators #-}
3−
4−module API where
5−
6−import Servant.API
7−
8−type API = Get '[JSON] () :<|> Get '[JSON] Int
test/front/API.hsdeleted−1
@@ -1 +0,0 @@
1−../common/API.hs
test/front/LICENSEdeleted−30
@@ -1,30 +0,0 @@
1−Copyright (c) 2016, Greg Hale
2−
3−All rights reserved.
4−
5−Redistribution and use in source and binary forms, with or without
6−modification, are permitted provided that the following conditions are met:
7−
8− * Redistributions of source code must retain the above copyright
9− notice, this list of conditions and the following disclaimer.
10−
11− * Redistributions in binary form must reproduce the above
12− copyright notice, this list of conditions and the following
13− disclaimer in the documentation and/or other materials provided
14− with the distribution.
15−
16− * Neither the name of Greg Hale nor the names of other
17− contributors may be used to endorse or promote products derived
18− from this software without specific prior written permission.
19−
20−THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21−"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22−LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23−A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24−OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25−SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26−LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27−DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28−THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29−(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30−OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
test/front/Main.hsdeleted−28
@@ -1,28 +0,0 @@
1−{-# LANGUAGE ScopedTypeVariables #-}
2−{-# LANGUAGE RankNTypes #-}
3−
4−module Main where
5−
6−import Servant.Reflex
7−import API
8−import Data.Proxy
9−import Reflex.Dom
10−import Reflex.Dom.Contrib.Xhr
11−
12−api :: Proxy API
13−api = Proxy
14−
15−url :: BaseUrl
16−url = BaseUrl Http "localhost" 8000 ""
17−
18−main :: IO ()
19−main = mainWidget run
20−
21−run :: forall t m. MonadWidget t m => m ()
22−run = do
23− let (getUnit :<|> get100) = client api url
24− b :: Event t () <- button "Get unit"
25− res :: Event t ((),()) <- getUnit b
26− c <- foldDyn (\_ (n :: Int) -> succ n) 0 res
27− display c
28−
test/front/default.nixdeleted−10
@@ -1,10 +0,0 @@
1−{ mkDerivation, base, servant, servant-reflex, stdenv }:
2−mkDerivation {
3− pname = "front";
4− version = "0.1.0.0";
5− src = ./.;
6− isLibrary = false;
7− isExecutable = true;
8− executableHaskellDepends = [ base servant servant-reflex ];
9− license = stdenv.lib.licenses.bsd3;
10−}
test/front/front.cabaldeleted−24
@@ -1,24 +0,0 @@
1−-- Initial front.cabal generated by cabal init. For further documentation,
2−-- see http://haskell.org/cabal/users-guide/
3−
4−name: front
5−version: 0.1.0.0
6−-- synopsis:
7−-- description:
8−license: BSD3
9−license-file: LICENSE
10−author: Greg Hale
11−maintainer: imalsogreg@gmail.com
12−-- copyright:
13−-- category:
14−build-type: Simple
15−-- extra-source-files:
16−cabal-version: >=1.10
17−
18−executable front
19− main-is: Main.hs
20− other-modules: API
21− other-extensions: ScopedTypeVariables, RankNTypes
22− build-depends: base >=4.8 && <4.9, servant, servant-reflex
23− -- hs-source-dirs:
24− default-language: Haskell2010
testserver/API.hsnew file+1
@@ -0,0 +1 @@
1+../exec/API.hs
test/back/LICENSE → testserver/LICENSErenamed

The content is the same.

test/back/Main.hs → testserver/Main.hsrenamed

The content is the same.

test/back/back.cabal → testserver/back.cabalrenamed

The content is the same.