[GHC] #15043: Expand type synonym
GHC
ghc-devs at haskell.org
Mon Apr 16 12:08:06 UTC 2018
#15043: Expand type synonym
-------------------------------------+-------------------------------------
Reporter: domenkozar | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone: 8.6.1
Component: Compiler (Type | Version: 8.2.2
checker) |
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Description changed by domenkozar:
Old description:
> 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.
New description:
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 in the expected type.
--
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15043#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list