#12371 closed bug (fixed)

Error message, room for improvement

Reported by: Iceland_jack Owned by:
Priority: normal Milestone: 8.0.2
Component: Compiler Version: 8.0.1
Keywords: TypeApplications Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Incorrect warning at compile-time Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

$ ghci -ignore-dot-ghci
GHCi, version 8.0.1: http://www.haskell.org/ghc/  :? for help
Prelude> :set -XPatternSynonyms 
Prelude> :set -XViewPatterns 
Prelude> pattern Foo a <- ((\uncons -> Just (a, as) -> a) -> a)

<interactive>:3:20: error:
    Pattern syntax in expression context: \ uncons -> Just (a, as) -> a
    Did you mean to enable TypeApplications?

Let's:

Prelude> :set -XTypeApplications
Prelude> pattern Foo a <- ((\uncons -> Just (a, as) -> a) -> a)

<interactive>:5:20: error:
    Pattern syntax in expression context: \ uncons -> Just (a, as) -> a
    Did you mean to enable TypeApplications?
Prelude> 

Change History (3)

comment:1 Changed 14 months ago by simonpj

Status: newmerge

Fixed in HEAD by

commit e38c07bf5ceb8f50fa5110b70b3b83f0ce1358ba
Author: Matthew Pickering <matthewtpickering@gmail.com>
Date:   Thu Feb 25 15:51:46 2016 +0100

    Improve accuracy of suggestion to use TypeApplications
    
    The suggestion only makes sense when we try
    to use an as pattern in an expression context.
    
    It is misleading in the case of a lazy pattern and
    view pattern.

May be worth merging?

comment:2 Changed 14 months ago by Iceland_jack

I think so

comment:3 Changed 13 months ago by bgamari

Milestone: 8.0.2
Resolution: fixed
Status: mergeclosed
Note: See TracTickets for help on using tickets.