git.iko.soy/typeable/servant-reflex
on master help sign in
Merge pull request #102 from imalsogreg/bump-reflex-frp
dac560cGreg Hale
.travis.yml+3−4
@@ -1,17 +1,16 @@
1language: nix
1language: nix
2−nix: 2.1.1
2+nix: 2.3.6
3sudo: require
3sudo: require
4
4
5−install:
5+before_install:
6 - sudo cp -rT $TRAVIS_BUILD_DIR/nix /etc/nix
6 - sudo cp -rT $TRAVIS_BUILD_DIR/nix /etc/nix
7
7
8before_script:
8before_script:
9+ - sudo systemctl restart nix-daemon.service
9 - git config --global user.email "travis-ci@example.com"
10 - git config --global user.email "travis-ci@example.com"
10 - git config --global user.name "Travis-CI"
11 - git config --global user.name "Travis-CI"
11
12
12script:
13script:
13− - nix-env -iA cachix -f https://cachix.org/api/v1/install
14− - cachix use imalsogreg
15 - nix-build travis.nix -A build
14 - nix-build travis.nix -A build
16 - nix-build travis.nix -A testserver
15 - nix-build travis.nix -A testserver
17 - nix-build travis.nix -A testresults
16 - nix-build travis.nix -A testresults
ChangeLog.md+8
@@ -1,3 +1,11 @@
1+0.3.5
2+-----
3+
4+ - Require reflex-dom-core >= 0.6 (for internal handling of case-insensitive headers)
5+ - Require servant >= 0.16
6+ - Eliminate use of deprecated widgets from reflex-dom-core
7+ - Bump the version of reflex-platform used in nix-shell and test suite
8+
10.3.4
90.3.4
2-----
10-----
3
11
default.nix+1−1
@@ -6,7 +6,7 @@
6}:
6}:
7mkDerivation {
7mkDerivation {
8 pname = "servant-reflex";
8 pname = "servant-reflex";
9− version = "0.3.4";
9+ version = "0.3.5";
10 src = builtins.filterSource
10 src = builtins.filterSource
11 (path: type:
11 (path: type:
12 baseNameOf path != "result"
12 baseNameOf path != "result"
nix/nix.conf+2−1
@@ -1,2 +1,3 @@
1−substituters = https://cache.nixos.org https://nixcache.reflex-frp.org
1+substituters = https://cache.nixos.org/ https://nixcache.reflex-frp.org/
2trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= ryantrinkle.com-1:JJiAKaRv9mWgpVAz8dwewnZe0AzzEAzPkagE9SP5NWI=
2trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= ryantrinkle.com-1:JJiAKaRv9mWgpVAz8dwewnZe0AzzEAzPkagE9SP5NWI=
3+trusted-users = travis
nix/reflex-platform.nix+2−2
@@ -1,7 +1,7 @@
1let
1let
2− rev = "a15d3a2411e7ca7d4ee4853b57c72fe83faee272";
2+ rev = "df0bdcca5eb2a3236ec0496e4430d91876b29cf5";
3in import (builtins.fetchTarball
3in import (builtins.fetchTarball
4 {
4 {
5 url = "https://github.com/reflex-frp/reflex-platform/archive/${rev}.tar.gz";
5 url = "https://github.com/reflex-frp/reflex-platform/archive/${rev}.tar.gz";
6− sha256 = "1dsvw0lah7761vndip1hqal4fjpjv84ravinnfhy83jgfav5ivna";
6+ sha256 = "1ja3vkq9px8f9iyiazq44mamaahgiphi9l236pvzbl5jvhi5c4qr";
7 }) {}
7 }) {}
nix/servant-snap.nix+4−6
@@ -1,9 +1,7 @@
1−# Servant-snap is stuck a bit behind atm. But we have a fork that mostly works
1+# Servant-snap is marked broken in nixpkgs
2−# except for streaming, which is good enough for this test server. See:
3−# https://github.com/haskell-servant/servant-snap/issues/20
4{ nixpkgs ? import <nixpkgs> {}}: self: super:
2{ nixpkgs ? import <nixpkgs> {}}: self: super:
5self.callCabal2nix "servant-snap" (nixpkgs.fetchgit {
3self.callCabal2nix "servant-snap" (nixpkgs.fetchgit {
6− url = "https://github.com/antislava/servant-snap.git";
4+ url = "https://github.com/haskell-servant/servant-snap.git";
7− rev = "fc9658e8f52ebce9e4f304ea0c6705d697d4fa84";
5+ rev = "af5172a6de5bb2a07eb1bf4c85952075ec6ecdf3";
8− sha256 = "0zlipmx1fb73mhpnndwmdmigxxrsdnsnb1157pgsrxpx89l9pjig";
6+ sha256 = "sha256-fzzQGwG8Ko72OO/kwLMG52eNZSt3F2dxhNgM9gaO4yQ=";
9}) {}
7}) {}
servant-reflex.cabal+13−5
@@ -1,5 +1,5 @@
1Name: servant-reflex
1Name: servant-reflex
2−Version: 0.3.4
2+Version: 0.3.5
3Synopsis: servant API generator for reflex apps
3Synopsis: servant API generator for reflex apps
4Description: Generate reflex-compatible client functions from servant API descriptions
4Description: Generate reflex-compatible client functions from servant API descriptions
5License: BSD3
5License: BSD3
@@ -36,10 +36,10 @@ library
36 jsaddle >= 0.8 && < 0.10,
36 jsaddle >= 0.8 && < 0.10,
37 mtl >= 2.2.1 && < 2.3,
37 mtl >= 2.2.1 && < 2.3,
38 network-uri >= 2.6 && < 2.7,
38 network-uri >= 2.6 && < 2.7,
39− reflex >= 0.5 && < 0.7,
39+ reflex >= 0.5 && < 0.8,
40− reflex-dom-core >= 0.4 && < 0.6,
40+ reflex-dom-core >= 0.6 && < 0.7,
41 safe >= 0.3.9 && < 0.4,
41 safe >= 0.3.9 && < 0.4,
42− servant >= 0.8 && < 0.18,
42+ servant >= 0.16 && < 0.18,
43 servant-auth >= 0.2.1 && < 0.4,
43 servant-auth >= 0.2.1 && < 0.4,
44 string-conversions >= 0.4 && < 0.5,
44 string-conversions >= 0.4 && < 0.5,
45 text >= 1.2 && < 1.3,
45 text >= 1.2 && < 1.3,
@@ -54,7 +54,15 @@ executable example
54 buildable: True
54 buildable: True
55 else
55 else
56 buildable: False
56 buildable: False
57− build-depends: aeson, reflex, servant-reflex, base, scientific, servant, reflex-dom-core, text
57+ build-depends:
58+ aeson,
59+ reflex,
60+ servant-reflex,
61+ base,
62+ scientific,
63+ servant,
64+ reflex-dom-core,
65+ text
58 default-language: Haskell2010
66 default-language: Haskell2010
59 main-is: Example.hs
67 main-is: Example.hs
60 other-modules: API
68 other-modules: API
src/Servant/Common/BaseUrl.hs+4−5
@@ -85,15 +85,14 @@ baseUrlWidget = elClass "div" "base-url" $ do
85 where pathWidget :: m (Dynamic t BaseUrl)
85 where pathWidget :: m (Dynamic t BaseUrl)
86 pathWidget = do
86 pathWidget = do
87 text "Url base path"
87 text "Url base path"
88− t <- textInput (def {_textInputConfig_attributes =
88+ t <- inputElement def
89− constDyn ("placeholder" =: "/a/b")})
90 return $ BasePath <$> value t
89 return $ BasePath <$> value t
91 fullUrlWidget :: m (Dynamic t BaseUrl)
90 fullUrlWidget :: m (Dynamic t BaseUrl)
92 fullUrlWidget = do
91 fullUrlWidget = do
93 schm <- dropdown Https (constDyn $ Https =: "https" <> Http =: "http") def
92 schm <- dropdown Https (constDyn $ Https =: "https" <> Http =: "http") def
94− srv <- textInput def {_textInputConfig_attributes = constDyn $ "placeholder" =: "example.com"}
93+ srv <- inputElement def
95 text ":"
94 text ":"
96− prt <- textInput def { _textInputConfig_attributes = constDyn $ "placeholder" =: "80"}
95+ prt <- inputElement def
97 port :: Dynamic t Int <- holdDyn 80 (fmapMaybe (readMaybe . T.unpack) $ updated (value prt))
96 port :: Dynamic t Int <- holdDyn 80 (fmapMaybe (readMaybe . T.unpack) $ updated (value prt))
98− path <- textInput def { _textInputConfig_attributes = constDyn $ "placeholder" =: "a/b" }
97+ path <- inputElement def
99 return $ BaseFullUrl <$> value schm <*> value srv <*> port <*> value path
98 return $ BaseFullUrl <$> value schm <*> value srv <*> port <*> value path
src/Servant/Reflex.hs+10−6
@@ -42,7 +42,7 @@ import Control.Applicative
42import Data.Monoid ((<>))
42import Data.Monoid ((<>))
43import qualified Data.Set as Set
43import qualified Data.Set as Set
44import qualified Data.Text.Encoding as E
44import qualified Data.Text.Encoding as E
45−import Data.CaseInsensitive (mk)
45+import qualified Data.CaseInsensitive as CI
46import Data.Functor.Identity
46import Data.Functor.Identity
47import Data.Proxy (Proxy (..))
47import Data.Proxy (Proxy (..))
48import qualified Data.Map as Map
48import qualified Data.Map as Map
@@ -226,22 +226,26 @@ instance {-# OVERLAPPING #-}
226
226
227toHeaders :: BuildHeadersTo ls => ReqResult tag a -> ReqResult tag (Headers ls a)
227toHeaders :: BuildHeadersTo ls => ReqResult tag a -> ReqResult tag (Headers ls a)
228toHeaders r =
228toHeaders r =
229− let toBS = E.encodeUtf8
230− hdrs = maybe []
229+ let hdrs = maybe []
231− (\xhr -> fmap (\(h,v) -> (mk (toBS h), toBS v))
230+ (\xhr -> fmap (\(h,v) -> (CI.map E.encodeUtf8 h, E.encodeUtf8 v))
232 (Map.toList $ _xhrResponse_headers xhr))
231 (Map.toList $ _xhrResponse_headers xhr))
233 (response r)
232 (response r)
234 in ffor r $ \a -> Headers {getResponse = a ,getHeadersHList = buildHeadersTo hdrs}
233 in ffor r $ \a -> Headers {getResponse = a ,getHeadersHList = buildHeadersTo hdrs}
235
234
235+
236class BuildHeaderKeysTo hs where
236class BuildHeaderKeysTo hs where
237− buildHeaderKeysTo :: Proxy hs -> [T.Text]
237+ buildHeaderKeysTo :: Proxy hs -> [CI.CI T.Text]
238
238
239instance {-# OVERLAPPABLE #-} BuildHeaderKeysTo '[]
239instance {-# OVERLAPPABLE #-} BuildHeaderKeysTo '[]
240 where buildHeaderKeysTo _ = []
240 where buildHeaderKeysTo _ = []
241
241
242instance {-# OVERLAPPABLE #-} (BuildHeaderKeysTo xs, KnownSymbol h)
242instance {-# OVERLAPPABLE #-} (BuildHeaderKeysTo xs, KnownSymbol h)
243 => BuildHeaderKeysTo ((Header h v) ': xs) where
243 => BuildHeaderKeysTo ((Header h v) ': xs) where
244+ buildHeaderKeysTo _ =
245+ let
246+ thisKey = CI.mk $ T.pack (symbolVal (Proxy :: Proxy h))
244− buildHeaderKeysTo _ = T.pack (symbolVal (Proxy :: Proxy h)) : buildHeaderKeysTo (Proxy :: Proxy xs)
247+ in thisKey : buildHeaderKeysTo (Proxy :: Proxy xs)
248+
245
249
246-- HEADERS Verb (Content) --
250-- HEADERS Verb (Content) --
247-- Headers combinator not treated in fully general case,
251-- Headers combinator not treated in fully general case,
testserver/testserver.cabal+3−3
@@ -19,13 +19,13 @@ executable back
19 main-is: Main.hs
19 main-is: Main.hs
20 -- other-modules:
20 -- other-modules:
21 -- other-extensions:
21 -- other-extensions:
22− build-depends: aeson >= 0.9 && < 1.4
22+ build-depends: aeson >= 0.9 && < 1.5
23− , base >=4.8 && <4.12
23+ , base >=4.8 && < 5
24 , mtl
24 , mtl
25 , snap >= 1.0 && < 1.2
25 , snap >= 1.0 && < 1.2
26 , snap-server >= 1.0 && < 1.2
26 , snap-server >= 1.0 && < 1.2
27 , snap-core >= 1.0 && < 1.1
27 , snap-core >= 1.0 && < 1.1
28− , servant >= 0.8 && < 0.15
28+ , servant >= 0.16 && < 0.18
29 , servant-snap >= 0.8 && < 0.9
29 , servant-snap >= 0.8 && < 0.9
30 , text >= 1.0 && < 1.3
30 , text >= 1.0 && < 1.3
31 -- hs-source-dirs:
31 -- hs-source-dirs: