Skip to content

COMPLETE pragma doesn't expand type synonyms

Summary

When attempting to work around #18276 (closed), I attempted to work around the parse error described there with a type synonym. The following is a minimal repro:

{-# LANGUAGE PatternSynonyms #-}

type List = []

pattern DefinitelyAString :: String -> String
pattern DefinitelyAString x = x
{-# COMPLETE DefinitelyAString :: List #-}

This seems reasonable, if roundabout. But GHC refuses to compile it:

    • Couldn't match expected type ‘List’ with ‘[]’
    • In DefinitelyAString
      In {-# COMPLETE DefinitelyAString :: List #-}
  |
7 | {-# COMPLETE DefinitelyAString :: List #-}
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Steps to reproduce

Compile the program above.

Expected behavior

The above program should compile.

Environment

  • GHC version used: 8.8.1 and 8.6.5

Optional:

  • Operating System:
  • System Architecture:
Edited by isovector
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information