[GHC] #15043: Expand type synonym

GHC ghc-devs at haskell.org
Mon Apr 16 12:05:25 UTC 2018


#15043: Expand type synonym
-------------------------------------+-------------------------------------
           Reporter:  domenkozar     |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:  8.6.1
          Component:  Compiler       |           Version:  8.2.2
  (Type checker)                     |
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 Using GHC 8.2.2 and `stack build --ghc-options=-fprint-expanded-synonyms`
 I have the following type synonym for servant:

 {{{#!hs
 type Get302 (cts :: [*]) (hs :: [*]) = Verb 'GET 302 cts
   (Headers (Header "Location" String ': hs) NoContent)
 }}}

 and get the following error message when `String` is mismatched for
 `Text`:

 {{{
         • Couldn't match type ‘Text’ with ‘[Char]’
           Expected type: AsServerT App
                          :- ("login"
                              :> ("callback"
                                  :> (QueryParam "code" Text
                                      :> (QueryParam "state" Text
                                          :> MyApp.Types.Servant.Get302
                                               '[PlainText]
                                               '[Header "Set-Cookie"
 SetCookie,
                                                 Header "Set-Cookie"
 SetCookie]))))
             Actual type: Maybe Code
                          -> Maybe Text
                          -> App
                               (Headers
                                  '[Header "Location" Text, Header "Set-
 Cookie" SetCookie,
                                    Header "Set-Cookie" SetCookie]
                                  NoContent)
 }}}

 The error is confusing as type synonym is not expanded and offending
 `Header` is missing from the output.

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15043>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list