Unknown option -XPatternSig used in warning

Hello, $ ghc --version The Glorious Glasgow Haskell Compilation System, version 6.7.20070915 When loading the following incorrect program in ghci: foo (x :: a) = x ghci rightly complains: Illegal signature in pattern: a Use -XPatternSigs to permit it OK so I follow the advice and load: {-# OPTIONS_GHC -XPatternSigs #-} foo (x :: a) = x Now ghci complains: unknown flags in {-# OPTIONS #-} pragma: -XPatternSigs ??? The following works though: {-# OPTIONS_GHC -fglasgow-exts #-} foo (x :: a) = x results in: A pattern type signature cannot bind scoped type variables `a' unless the pattern has a rigid type context In the pattern: x :: a In the definition of `foo': foo (x :: a) = x Which I expect. Should I file a bug report, or is there an easy fix? regards, Bas van Dijk

I believe this is a known problem with OPTIONS_GHC, and will work on the command line. I think Ian is working on it. Ian? Simon | -----Original Message----- | From: glasgow-haskell-users-bounces@haskell.org [mailto:glasgow-haskell-users-bounces@haskell.org] On | Behalf Of Bas van Dijk | Sent: 19 September 2007 13:20 | To: glasgow-haskell-users@haskell.org | Subject: Unknown option -XPatternSig used in warning | | Hello, | | $ ghc --version | The Glorious Glasgow Haskell Compilation System, version 6.7.20070915 | | | When loading the following incorrect program in ghci: | | foo (x :: a) = x | | ghci rightly complains: | | Illegal signature in pattern: a | Use -XPatternSigs to permit it | | OK so I follow the advice and load: | | {-# OPTIONS_GHC -XPatternSigs #-} | | foo (x :: a) = x | | Now ghci complains: | | unknown flags in {-# OPTIONS #-} pragma: -XPatternSigs ??? | | The following works though: | | {-# OPTIONS_GHC -fglasgow-exts #-} | | foo (x :: a) = x | | results in: | | A pattern type signature cannot bind scoped type variables `a' | unless the pattern has a rigid type context | In the pattern: x :: a | In the definition of `foo': foo (x :: a) = x | | Which I expect. | | Should I file a bug report, or is there an easy fix? | | regards, | | Bas van Dijk | _______________________________________________ | Glasgow-haskell-users mailing list | Glasgow-haskell-users@haskell.org | http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

On 9/19/07, Simon Peyton-Jones
I believe this is a known problem with OPTIONS_GHC, and will work on the command line. I think Ian is working on it. Ian?
Via the command line I get the same problem: $ ghci -XPatternSigs PatternSig.hs GHCi, version 6.7.20070915: http://www.haskell.org/ghc/ :? for help ghc-6.7.20070915: unrecognised flags: -XPatternSigs Usage: For basic information, try the `--help' option. Bas

Via the command line I get the same problem:
$ ghci -XPatternSigs PatternSig.hs GHCi, version 6.7.20070915: http://www.haskell.org/ghc/ :? for help ghc-6.7.20070915: unrecognised flags: -XPatternSigs Usage: For basic information, try the `--help' option.
$ /cygdrive/c/fptools/ghc/compiler/stage2/ghc-inplace --supported-languages | grep Pat PatternGuards PatternSignatures BangPatterns MonoPatBinds could it be that the error message is incorrect, pointing to an abbreviated form?
Illegal signature in pattern: a Use -XPatternSigs to permit it
claus

Claus is right. The bug is in the error message. I'll push a fix. S | -----Original Message----- | From: glasgow-haskell-users-bounces@haskell.org [mailto:glasgow-haskell-users-bounces@haskell.org] On | Behalf Of Claus Reinke | Sent: 19 September 2007 14:57 | To: Bas van Dijk; Simon Peyton-Jones | Cc: glasgow-haskell-users@haskell.org | Subject: Re: Unknown option -XPatternSig used in warning | | > Via the command line I get the same problem: | > | > $ ghci -XPatternSigs PatternSig.hs | > GHCi, version 6.7.20070915: http://www.haskell.org/ghc/ :? for help | > ghc-6.7.20070915: unrecognised flags: -XPatternSigs | > Usage: For basic information, try the `--help' option. | | $ /cygdrive/c/fptools/ghc/compiler/stage2/ghc-inplace --supported-languages | grep Pat | PatternGuards | PatternSignatures | BangPatterns | MonoPatBinds | | could it be that the error message is incorrect, pointing | to an abbreviated form? | | > Illegal signature in pattern: a | > Use -XPatternSigs to permit it | | claus | | | _______________________________________________ | Glasgow-haskell-users mailing list | Glasgow-haskell-users@haskell.org | http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

On 9/19/07, Simon Peyton-Jones
...I'll push a fix.
Thanks! It works now: $ ghci -XPatternSignatures PatternSig.hs GHCi, version 6.9.20070919: http://www.haskell.org/ghc/ :? for help Loading package base ... linking ... done. [1 of 1] Compiling Main ( PatternSig.hs, interpreted ) PatternSig.hs:2:10: Not in scope: type variable `a' Failed, modules loaded: none. Bas

| Illegal signature in pattern: a | Use -XPatternSigs to permit it |
I am very happy to see that it doesn't recommend -fglasgow-exts anymore! However, I still would prefer Use LANGUAGE pragma with extension ``PatternSigs'' to permit it since it points out even more things that many may not have known before... By the way, some of my LANGUAGE pragmas are getting quite long, and last time I tried I was not allowed to have a line break in there. Are there any plans to allow line breaks, or multiple LANGUAGE pragmas? Wolfram

Hi Wolfram, On Wed, Sep 19, 2007 at 01:45:00PM -0000, kahl@cas.mcmaster.ca wrote:
By the way, some of my LANGUAGE pragmas are getting quite long, and last time I tried I was not allowed to have a line break in there.
What version of GHC are you using? This works in 6.6: {-# LANGUAGE MultiParamTypeClasses, OverlappingInstances #-} module Q where class Foo a b where foo :: a -> b instance Foo Int Bool instance Foo Int a x :: Int -> Bool x = foo
Are there any plans to allow line breaks, or multiple LANGUAGE pragmas?
This also works: {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE OverlappingInstances #-} module Q where class Foo a b where foo :: a -> b instance Foo Int Bool instance Foo Int a x :: Int -> Bool x = foo Thanks Ian
participants (6)
-
Bas van Dijk
-
Claus Reinke
-
Ian Lynagh
-
kahl@cas.mcmaster.ca
-
Simon Peyton-Jones
-
Wolfgang Jeltsch