[GHC] #12837: Disallow users to write instances for KnownNat and KnownSymbol (was: KnownNat and KnownSymbol should be abstract)
GHC
ghc-devs at haskell.org
Sat Dec 24 17:34:55 UTC 2016
#12837: Disallow users to write instances for KnownNat and KnownSymbol
-------------------------------------+-------------------------------------
Reporter: adamgundry | Owner: sean
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.0.1
Resolution: | Keywords: newcomer
Operating System: Unknown/Multiple | Architecture:
Type of failure: GHC accepts | Unknown/Multiple
invalid program | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s): Phab:D2898
Wiki Page: |
-------------------------------------+-------------------------------------
Description changed by sean:
@@ -9,3 +9,3 @@
- This is accepted (albeit with a warning about the missing `natSing`
- method). I think it should be rejected, as should an instance of
- `KnownSymbol`. Compare doing the same thing with `Typeable`, which says:
+ Originally this was accepted (albeit with a warning about the missing
+ `natSing` method). It is now rejected, as with instances of `KnownSymbol`,
+ in the same way as instances of `Typeable`, which says:
New description:
Consider the following patent nonsense:
{{{#!hs
{-# LANGUAGE FlexibleInstances #-}
import GHC.TypeLits
instance KnownNat n
}}}
Originally this was accepted (albeit with a warning about the missing
`natSing` method). It is now rejected, as with instances of `KnownSymbol`,
in the same way as instances of `Typeable`, which says:
{{{
Class ‘Typeable’ does not support user-specified instances
}}}
--
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12837#comment:5>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list