Opened 3 years ago

Last modified 9 months ago

#13322 new feature request

Pattern synonyms in hs-boot files

Reported by: ezyang Owned by:
Priority: low Milestone:
Component: Compiler (Type checker) Version: 8.1
Keywords: hs-boot backpack Cc: monoidal
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


Pattern synonyms are not permitted in hs-boot files:

ezyang@sabre:~/bun$ ghc-head -c A.hs-boot

A.hs-boot:3:5: error:
    Misplaced pattern synonym signature: pattern X :: Bool
3 |     pattern X :: Bool
  |     ^^^^^^^^^^^^^^^^^

A.hs-boot:3:13: error:
    The pattern synonym signature for ‘X’ lacks an accompanying binding
3 |     pattern X :: Bool

There isn't really any reason why they shouldn't be supported.

One thing to check closely: if we bundle a pattern synonym declared in an hs-boot file with another type, in an hs-boot file, what happens? In particular, does an hs file which doesn't bundle the pattern synonym and the type valid?

If we add support for them, make sure that Backpack signatures handle it properly. In particular, suppose we have:

signature A(T(X)) where
  data T
  pattern X :: T

Then, when we instantiate A, we must be careful to NOT blindly reuse the implementing module of T for X (as we do today in uAvailInfo in NameShape), since T and X may be defined in different modules.

I'm not likely to implement this unless someone asks.

Change History (1)

comment:1 Changed 9 months ago by monoidal

Cc: monoidal added
Note: See TracTickets for help on using tickets.