diff --git a/.travis.yml b/.travis.yml index fad01fd..7a8a046 100644 --- a/.travis.yml +++ b/.travis.yml @@ -73,6 +73,10 @@ matrix: compiler: ": #stack 8.0.1" addons: {apt: {packages: [cabal-install-1.24,ghc-8.0.1,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}} + - env: BUILD=stack ARGS="--stack-yaml stack-ghc-8.2.yaml" + compiler: ": #stack 8.2.2" + addons: {apt: {packages: [cabal-install-1.24,ghc-8.0.1,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}} + # Nightly builds are allowed to fail - env: BUILD=stack ARGS="--resolver nightly" compiler: ": #stack nightly" @@ -95,6 +99,10 @@ matrix: compiler: ": #stack 8.0.1 osx" os: osx + - env: BUILD=stack ARGS="--stack-yaml stack-ghc-8.2.yaml" + compiler: ": #stack 8.2.2 osx" + os: osx + - env: BUILD=stack ARGS="--resolver nightly" compiler: ": #stack nightly osx" os: osx @@ -174,4 +182,4 @@ script: done ;; esac - set +ex \ No newline at end of file + set +ex diff --git a/solga/src/Solga.hs b/solga/src/Solga.hs index 43f212a..a3fcfaf 100644 --- a/solga/src/Solga.hs +++ b/solga/src/Solga.hs @@ -54,7 +54,6 @@ import Control.Exception.Safe import Control.Monad import Control.Monad.Trans.Resource import qualified Data.Aeson as Aeson -import qualified Data.Aeson.Encode as Aeson import qualified Data.ByteString.Builder as Builder import qualified Data.ByteString.Char8 as Char8 import qualified Data.Map.Strict as Map @@ -170,7 +169,7 @@ data OneOfSegs (segs :: [ Symbol ]) next = OneOfSegs { oneOfSegsNext :: next } instance (KnownSymbol seg, Router next, Router (OneOfSegs segs next)) => Router (OneOfSegs (seg ': segs) next) where tryRoute = tryRouteNext $ \(OneOfSegs next) -> (Seg next :: Seg seg next) :<|> (OneOfSegs next :: OneOfSegs segs next) -instance Router next => Router (OneOfSegs '[] next) where +instance Router (OneOfSegs '[] next) where tryRoute _ = Nothing -- | The class of types that can be parsed from a path segment. @@ -283,7 +282,7 @@ class Abbreviated a where type Brief a :: * type instance Brief a = a brief :: Brief a -> a - default brief :: a -> a + default brief :: Brief a ~ a => Brief a -> a brief = id instance Abbreviated Raw where diff --git a/solga/test/Test.hs b/solga/test/Test.hs index 4ed30aa..167693e 100644 --- a/solga/test/Test.hs +++ b/solga/test/Test.hs @@ -1,9 +1,10 @@ -{-# LANGUAGE TypeOperators #-} -{-# LANGUAGE DataKinds #-} -{-# LANGUAGE OverloadedStrings #-} -{-# LANGUAGE DeriveGeneric #-} -{-# LANGUAGE QuasiQuotes #-} -{-# LANGUAGE StandaloneDeriving #-} +{-# LANGUAGE CPP #-} +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE DeriveGeneric #-} +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE QuasiQuotes #-} +{-# LANGUAGE StandaloneDeriving #-} +{-# LANGUAGE TypeOperators #-} {-# OPTIONS_GHC -fno-warn-orphans #-} module Main (main) where @@ -93,7 +94,9 @@ spec = with (return $ serve testAPI) $ do resp <- get path liftIO $ decode (simpleBody resp) `shouldBe` Just (String seg) +#if __GLASGOW_HASKELL__ < 802 deriving instance Generic Value +#endif instance Arbitrary Value where arbitrary = sized arbJSON @@ -133,4 +136,4 @@ instance Arbitrary a => Arbitrary (V.Vector a) where instance Arbitrary S.Scientific where arbitrary = S.scientific <$> arbitrary <*> arbitrary - shrink s = map (uncurry S.scientific) $ shrink $ ( S.coefficient s, S.base10Exponent s ) \ No newline at end of file + shrink s = map (uncurry S.scientific) $ shrink $ ( S.coefficient s, S.base10Exponent s ) diff --git a/stack-ghc-8.2.yaml b/stack-ghc-8.2.yaml new file mode 100644 index 0000000..0d92ca3 --- /dev/null +++ b/stack-ghc-8.2.yaml @@ -0,0 +1,33 @@ +# For more information, see: https://github.com/commercialhaskell/stack/blob/release/doc/yaml_configuration.md + +# Specifies the GHC version and set of packages available (e.g., lts-3.5, nightly-2015-09-21, ghc-7.10.2) +resolver: lts-11.22 + +# Local packages, usually specified by relative directory name +packages: +- 'solga' +- 'solga-swagger' + +# Packages to be pulled from upstream that are not in the resolver (e.g., acme-missiles-0.3) +extra-deps: [] + +# Override default flag values for local packages and extra-deps +flags: {} + +# Extra package databases containing global packages +extra-package-dbs: [] + +# Control whether we use the GHC we find on the path +# system-ghc: true + +# Require a specific version of stack, using version ranges +# require-stack-version: -any # Default +# require-stack-version: >= 1.0.0 + +# Override the architecture used by stack, especially useful on Windows +# arch: i386 +# arch: x86_64 + +# Extra directories used by stack for building +# extra-include-dirs: [/path/to/dir] +# extra-lib-dirs: [/path/to/dir]