Skip to content

A more aggressive version of -fprint-expanded-synonyms that prints all type synonyms

Using GHC 8.2.2 and stack build --ghc-options=-fprint-expanded-synonyms I have the following type synonym for servant:

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.

Edited by Ryan Scott
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information