GHC: Ticket #8555: Simplify given `Coercible` constraints
http://ghc.haskell.org/trac/ghc/ticket/8555
<p>
It would be feasible and possibly useful if
</p>
<pre class="wiki">foo :: Coercible [a] [b] => a -> b
foo = coerce
</pre><p>
would work. This involve simplifying <code>CtGiven</code>s similar to how given (nominal) equalities are simplified.
</p>
<p>
I’ll defer working on this, as it is not strictly required, it seems.
</p>
en-usGHChttp://ghc.haskell.org/trac/ghc/chrome/site/ghc_logo.png
http://ghc.haskell.org/trac/ghc/ticket/8555
Trac 1.2goldfireFri, 22 Nov 2013 21:54:29 GMT
http://ghc.haskell.org/trac/ghc/ticket/8555#comment:1
http://ghc.haskell.org/trac/ghc/ticket/8555#comment:1
<p>
Certainly nothing blocking this at the Core level... the <code>Nth</code> coercion constructor would do the right thing here.
</p>
TicketnomeataTue, 18 Feb 2014 17:22:50 GMTrelated changed
http://ghc.haskell.org/trac/ghc/ticket/8555#comment:2
http://ghc.haskell.org/trac/ghc/ticket/8555#comment:2
<ul>
<li><strong>related</strong>
changed from <em>#8503</em> to <em>#8503 #8555</em>
</li>
</ul>
TicketarchblobMon, 12 May 2014 16:51:37 GMTowner, cc set
http://ghc.haskell.org/trac/ghc/ticket/8555#comment:3
http://ghc.haskell.org/trac/ghc/ticket/8555#comment:3
<ul>
<li><strong>owner</strong>
set to <em>archblob</em>
</li>
<li><strong>cc</strong>
<em>fcsernik@…</em> added
</li>
</ul>
<p>
This looks like a good place to further my understanding of ghc internals so I'll give it a try if no one else is doing it currently, so if someone is, please say so and don't let me waste my time :-P.
</p>
TicketnomeataMon, 12 May 2014 18:02:02 GMT
http://ghc.haskell.org/trac/ghc/ticket/8555#comment:4
http://ghc.haskell.org/trac/ghc/ticket/8555#comment:4
<p>
Nobody is working on it, so if you feel like it, please give it a shot. (But also beware that in the last months, nobody was missing the feature, so it may have a limited impact – don’t let that lessen your motivation!)
</p>
TicketsimonpjMon, 19 May 2014 16:07:12 GMT
http://ghc.haskell.org/trac/ghc/ticket/8555#comment:5
http://ghc.haskell.org/trac/ghc/ticket/8555#comment:5
<p>
I doubt that this is very useful in practice. I think there are plenty of other more directly useful tickets. Eg look at <a class="wiki" href="http://ghc.haskell.org/trac/ghc/wiki/Status/SLPJ-Tickets">Status/SLPJ-Tickets</a>. For example, <a class="closed ticket" href="http://ghc.haskell.org/trac/ghc/ticket/5610" title="#5610: feature request: Improve "Unacceptable argument type in foreign declaration" error message (closed: fixed)">#5610</a>/<a class="closed ticket" href="http://ghc.haskell.org/trac/ghc/ticket/7243" title="#7243: bug: regression: acceptable foreign result types (closed: fixed)">#7243</a> looks tractable and useful. <a class="new ticket" href="http://ghc.haskell.org/trac/ghc/ticket/8281" title="#8281: bug: The impossible happened: primRepToFFIType (new)">#8281</a> looks as if it needs a push. Etc.
</p>
<p>
Simon
</p>
TicketarchblobMon, 19 May 2014 16:42:52 GMT
http://ghc.haskell.org/trac/ghc/ticket/8555#comment:6
http://ghc.haskell.org/trac/ghc/ticket/8555#comment:6
<p>
Yeah, I am more interested in the typechecker part of ghc at the moment, so I just chose something recent. I'll certainly have a lookt at those tickets and see if I can help. :)
</p>
TicketarchblobSat, 24 May 2014 08:11:16 GMTowner deleted
http://ghc.haskell.org/trac/ghc/ticket/8555#comment:7
http://ghc.haskell.org/trac/ghc/ticket/8555#comment:7
<ul>
<li><strong>owner</strong>
<em>archblob</em> deleted
</li>
</ul>
TicketnomeataTue, 19 May 2015 10:38:18 GMTstatus, cc changed; resolution set
http://ghc.haskell.org/trac/ghc/ticket/8555#comment:8
http://ghc.haskell.org/trac/ghc/ticket/8555#comment:8
<ul>
<li><strong>status</strong>
changed from <em>new</em> to <em>closed</em>
</li>
<li><strong>cc</strong>
<em>goldfire</em> added
</li>
<li><strong>resolution</strong>
set to <em>fixed</em>
</li>
</ul>
<p>
Due to Richards rewrite of the Coercible parser, this now works.
</p>
TicketSimon Peyton Jones <simonpj@…>Tue, 19 May 2015 10:49:28 GMT
http://ghc.haskell.org/trac/ghc/ticket/8555#comment:9
http://ghc.haskell.org/trac/ghc/ticket/8555#comment:9
<p>
In <a class="changeset" href="http://ghc.haskell.org/trac/ghc/changeset/fc8c5e7a516803c04f2a38b53b9e8beb2066c056/ghc" title="Test Trac #8799, #8555">fc8c5e7a516803c04f2a38b53b9e8beb2066c056/ghc</a>:
</p>
<pre class="message">Test Trac #8799, #8555</pre>
TicketsimonpjTue, 19 May 2015 11:08:47 GMTtestcase set
http://ghc.haskell.org/trac/ghc/ticket/8555#comment:10
http://ghc.haskell.org/trac/ghc/ticket/8555#comment:10
<ul>
<li><strong>testcase</strong>
set to <em>typecheck/should_compile/T8555</em>
</li>
</ul>
TicketthomieThu, 07 Jan 2016 13:31:55 GMT
http://ghc.haskell.org/trac/ghc/ticket/8555#comment:11
http://ghc.haskell.org/trac/ghc/ticket/8555#comment:11
<p>
For future reference:
</p>
<p>
commit <a class="changeset" href="http://ghc.haskell.org/trac/ghc/changeset/0cc47eb90805f3e166ac4d3991e66d3346ca05e7/ghc" title="Rewrite `Coercible` solver
Summary:
This is a rewrite of the ...">0cc47eb90805f3e166ac4d3991e66d3346ca05e7</a>
</p>
<pre class="wiki">Author: Richard Eisenberg <eir@cis.upenn.edu>
Date: Fri Dec 12 17:19:21 2014 -0500
Rewrite `Coercible` solver
Summary:
This is a rewrite of the algorithm to solve for Coercible "instances".
A preliminary form of these ideas is at
https://ghc.haskell.org/trac/ghc/wiki/Design/NewCoercibleSolver
The basic idea here is that the `EqPred` constructor of `PredTree`
now is parameterised by a new type `EqRel` (where
`data EqRel = NomEq | ReprEq`). Thus, every equality constraint can
now talk about nominal equality (the usual case) or representational
equality (the `Coercible` case).
This is a change from the previous
behavior where `Coercible` was just considered a regular class with
a special case in `matchClassInst`.
Because of this change, representational equalities are now
canonicalized just like nominal ones, allowing more equalities
to be solved -- in particular, the case at the top of #9117.
A knock-on effect is that the flattener must be aware of the
choice of equality relation, because the inert set now stores
both representational inert equalities alongside the nominal
inert equalities. Of course, we can use representational equalities
to rewrite only within another representational equality --
thus the parameterization of the flattener.
A nice side effect of this change is that I've introduced a new
type `CtFlavour`, which tracks G vs. W vs. D, removing some ugliness
in the flattener.
This commit includes some refactoring as discussed on D546.
It also removes the ability of Deriveds to rewrite Deriveds.
This fixes bugs #9117 and #8984.
Reviewers: simonpj, austin, nomeata
Subscribers: carter, thomie
Differential Revision: https://phabricator.haskell.org/D546
GHC Trac Issues: #9117, #8984
</pre>
Ticket