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 ()