Re: [GHC] #8026: DatatypeContexts should be fixed, not deprecated

#8026: DatatypeContexts should be fixed, not deprecated -------------------------------------+------------------------------------- Reporter: gidyn | Owner: Type: feature | Status: new request | Milestone: Priority: normal | Version: 7.6.3 Component: Compiler | Keywords: Resolution: | Architecture: Unknown/Multiple Operating System: | Difficulty: Unknown Unknown/Multiple | Blocked By: Type of failure: | Related Tickets: None/Unknown | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by gidyn): Consider the first example {{{ data Eq a => Foo a = Foo a isEq :: Foo a -> Foo a -> Bool isEq (Foo x) (Foo y) = x == y }}} This won't compile, because `isEq` is missing `Eq a =>`. However, with [https://ghc.haskell.org/trac/ghc/wiki/PartialTypeSignatures#extra- constraints-wildcard Partial Type Signatures], we can write {{{ isEq :: _ => Foo a -> Foo a -> Bool }}} and GHC will infer the constraint. This proposal is requesting that whenever `DatatypeContexts` has been turned on, and a data type appears in a type signature, GHC will automatically infer the data type's context in the same way as it would for an extra-constraints wildcard. Is this clearer? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8026#comment:16 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC