
#11220: Stack overflow instead of type check failure in Servant route -------------------------------------+------------------------------------- Reporter: sopvop | Owner: Type: bug | Status: new Priority: high | Milestone: 8.0.1 Component: Compiler (Type | Version: 7.10.3 checker) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time | Unknown/Multiple crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * cc: goldfire (added) Old description:
GHC 7.10.3 eats a lot of memory and segfaults compiling this.
{{{#!hs {-# LANGUAGE DataKinds #-} {-# LANGUAGE EmptyDataDecls #-} {-# LANGUAGE TypeOperators #-} module Main where
import Data.Proxy
import Servant.API -- requires servant
data A
apiP :: Proxy Api apiP = Proxy
-- Users
type Api = "variants" :> Get '[JSON] ()
routeL :: URI routeL = safeLink apiP (Proxy :: Proxy ("variants" :> Get '[A] ())) -- Should result in type error -- '[JSON] in route but '[A] here
main = print routeL
}}}
There is '[ JSON ] in Api type, but '[A] in Proxy type passed to safeLink, so it should result in type error.
Correct program compiles without problems.
New description: GHC 7.10.3 eats a lot of memory and segfaults compiling this. {{{#!hs {-# LANGUAGE DataKinds #-} {-# LANGUAGE EmptyDataDecls #-} {-# LANGUAGE TypeOperators #-} module Main where import Data.Proxy import Servant.API -- requires servant data A apiP :: Proxy Api apiP = Proxy -- Users type Api = "variants" :> Get '[JSON] () routeL :: URI routeL = safeLink apiP (Proxy :: Proxy ("variants" :> Get '[A] ())) -- Should result in type error -- '[JSON] in route but '[A] here main = print routeL }}} There is `'[ JSON ]` in `Api` type, but `'[A]` in `Proxy` type passed to `safeLink`, so it should result in type error. Correct program compiles without problems. -- -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11220#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler