From 6fff76e304a7aa037d49e098db960630ef0e36ce Mon Sep 17 00:00:00 2001 From: Oleg Grenrus Date: Mon, 15 May 2017 19:45:14 +0300 Subject: [PATCH] Add regression test for #734 --- servant/servant.cabal | 1 + servant/test/Servant/Utils/EnterSpec.hs | 32 +++++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 servant/test/Servant/Utils/EnterSpec.hs diff --git a/servant/servant.cabal b/servant/servant.cabal index 64039227..94d22668 100644 --- a/servant/servant.cabal +++ b/servant/servant.cabal @@ -112,6 +112,7 @@ test-suite spec Servant.API.ContentTypesSpec Servant.API.ResponseHeadersSpec Servant.Utils.LinksSpec + Servant.Utils.EnterSpec build-depends: base == 4.* , base-compat diff --git a/servant/test/Servant/Utils/EnterSpec.hs b/servant/test/Servant/Utils/EnterSpec.hs new file mode 100644 index 00000000..0453f83a --- /dev/null +++ b/servant/test/Servant/Utils/EnterSpec.hs @@ -0,0 +1,32 @@ +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE TypeOperators #-} +module Servant.Utils.EnterSpec where + +import Test.Hspec (Spec) + +import Servant.API +import Servant.Utils.Enter + +------------------------------------------------------------------------------- +-- https://github.com/haskell-servant/servant/issues/734 +------------------------------------------------------------------------------- + +-- This didn't fail if executed in GHCi; cannot have as a doctest. + +data App a + +f :: App :~> App +f = NT id + +server :: App Int :<|> (String -> App Bool) +server = undefined + +server' :: App Int :<|> (String -> App Bool) +server' = enter f server + +------------------------------------------------------------------------------- +-- Spec +------------------------------------------------------------------------------- + +spec :: Spec +spec = return ()