#5676: Typeclass instance function type declarations
---------------------------------+------------------------------------------
Reporter: drb226 | Owner:
Type: feature request | Status: new
Priority: normal | Component: Compiler
Version: | Keywords: typeclass instance function
type declaration
Testcase: | Blockedby:
Os: Unknown/Multiple | Blocking:
Architecture: Unknown/Multiple | Failure: GHC rejects valid program
---------------------------------+------------------------------------------
See discussion at http://stackoverflow.com/questions/8367426/why-cant-one-
put-type-signatures-in-instance-declarations-in-haskell
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.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5676>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs