#12108 closed bug (fixed)

Function type synonym fails in pattern synonym

Reported by: Iceland_jack Owned by: simonpj
Priority: normal Milestone:
Component: Compiler Version: 8.0.1
Keywords: PatternSynonyms Cc: mpickering
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case: patsyn/should_compile/T12108
Blocked By: Blocking:
Related Tickets: 11977 Differential Rev(s):
Wiki Page:

Description

pattern Id :: a -> a
pattern Id x = x

works but

-- • Pattern synonym ‘Id’ has one argument
--     but its type signature has none
-- • In the declaration for pattern synonym ‘Id’
type Endo a = a -> a

pattern Id :: Endo a
pattern Id x = x

Change History (4)

comment:1 Changed 13 months ago by Iceland_jack

Cc: mpickering added

comment:2 Changed 13 months ago by simonpj

Owner: set to simonpj

Similar to #11977, which I am fixing.

comment:3 Changed 13 months ago by Simon Peyton Jones <simonpj@…>

In 03d89603/ghc:

Don't split the arg types in a PatSyn signature

This patch fixes Trac #11977, and #12108, rather satisfactorily
maily by deleting code!

  pattern P :: Eq a => a -> a -> Int

The idea is simply /not/ to split the bit after the '=>' into the
pattern argument types, but to keep the (a->a->Int) part
un-decomposed, in the patsig_body_ty field of a TcPatSynInfo.

There is one awkward wrinkle, which is that we can't split the
implicitly-bound type variables into existential and universal until
we know which types are arguments and which are part of the result.
So we postpone the decision until we have the declaration in hand.
See TcPatSyn Note [The pattern-synonym signature splitting rule]

comment:4 Changed 13 months ago by simonpj

Resolution: fixed
Status: newclosed
Test Case: patsyn/should_compile/T12108
Note: See TracTickets for help on using tickets.