id,summary,reporter,owner,description,type,status,priority,milestone,component,version,resolution,keywords,cc,os,architecture,failure,difficulty,testcase,blockedby,blocking,related
5324,Locally-scoped RULES,reinerp,,"I'd like the following to compile:

{{{
module A where

f = g where
  {-# RULES ""g/h"" g = h #-}
  g = undefined
  h = undefined
}}}

This doesn't currently compile, because all RULES have to be top-level. 

However, GHC permits SPECIALISE pragmas at local scope; the following compiles:
{{{
module Test where

f :: Num a => a -> a
f = g where
  {-# SPECIALISE g :: Int -> Int #-}
  g :: Num b => b -> b
  g x = x + x
}}}

(Admittedly, this example discards the specialisation, but more interesting examples don't.)

I only point out that the SPECIALISE pragma succeeds, because the user manual has the comment that rules subsume the 'Obsolete SPECIALIZE syntax', but in this case they don't.

I've got a real example where I would like locally-scoped RULES, but it is rather long, so I will post it as a comment.",feature request,new,normal,_|_,Compiler,7.0.3,,,,Unknown/Multiple,Unknown/Multiple,None/Unknown,,,,,
