implicit params in instance contexts
shachaf at gmail.com
Tue Jul 16 10:29:33 CEST 2013
On Mon, Jul 15, 2013 at 11:21 PM, Ganesh Sittampalam <ganesh at earth.li> wrote:
> It seems that from GHC 7.4, the prohibition on implicit parameter
> constraints in instance declarations has been relaxed. The program below
> gives the error "Illegal constraint ?fooRev::Bool" in GHC 7.2.1 but
> loads fine in GHC 7.4.2 and GHC 7.6.2.
> I can't spot anything about this in the release notes, and the
> still says "You can't have an implicit parameter in the context of a
> class or instance declaration."
> So I wonder if this happened by accident, perhaps as part of the
> ConstraintKinds work or similar?
> I've wanted this feature a few times so if it's going to stay I might
> start using it. However it is a bit dangerous, so if it was added by
> accident it might warrant some discussion before deciding to keep it.
> For example as the value "set2" below shows, it can be used to violate
> datatype invariants.
There was a post about this previously:
And a GHC ticket: http://ghc.haskell.org/trac/ghc/ticket/7624
See also the discussion at
More information about the Glasgow-haskell-users