Typeclass instance function type declarations
|Reported by:||drb226||Owned by:||simonpj|
|Component:||Compiler (Type checker)||Version:|
|Keywords:||typeclass instance function type declaration||Cc:||fuzxxl@…|
|Type of failure:||GHC rejects valid program||Test Case:||typecheck/should_compile/T5676|
|Related Tickets:||Differential Rev(s):|
Basically, it would be nice to be able to do something like this:
instance Functor Maybe where fmap :: (a -> b) -> Maybe a -> Maybe b fmap = undefined
This currently produces a "misplaced type signature" error.
It seems like a simple enough extension (we could call it SuperfluousTypeclassSignatures, because "Superfluous" is a cool word). It might be a good idea for Haskell Prime, but let's test it out as a Glasgow extension first.
We (a few of us on #haskell irc right now) think it best that only the precisely correct type signatures be accepted (reject signatures that are too lose or too strong), and it would be nice if, given an incorrect type signature, a custom error message were displayed stating the correct type signature.
Change History (9)
comment:1 Changed 5 years ago by FUZxxl
- Cc fuzxxl@… added
- Component changed from Compiler to Compiler (Type checker)
comment:7 Changed 5 years ago by simonpj
- difficulty set to Unknown
- Resolution set to fixed
- Status changed from new to closed
- Test Case set to typecheck/should_compile/T5676