Functions for builtin operators (?)
simonpj at microsoft.com
Sun May 10 13:52:09 EDT 2009
sorry, got diverted by paper writing.
GHC desugars Hsakell into Core, and it's Core that you are consuming in the ESC stuff. However, Core for an *overloaded* function contains dictionary applications and abstractions. Furthermore, overloaded operators turn into selectors, which pick out a particular field from a dictionary. See any description of how to compile type classes for examples of this.
So here you've got something like
(>) d x y
where (>) is defined like this
(>) (MkOrd _ _ gr _) = gr
That is, (>) picks out the gr field from the dictionary. So it's all very higher-order in reality. And that is what is giving trouble to the ESC stuff. After all, what do we know about *all* implementations of (>) at *all* types? Not much!
Dana and I did not explore much how to give a good treatment to overloaded functions. I would not expect it to "just work".
I hope this helps a bit
| -----Original Message-----
| From: Colin Paul Adams [mailto:colin at colina.demon.co.uk]
| Sent: 08 April 2009 11:04
| To: Simon Peyton-Jones
| Cc: glasgow-haskell-users at haskell.org
| Subject: Re: Functions for builtin operators (?)
| >>>>> "Simon" == Simon Peyton-Jones <simonpj at microsoft.com> writes:
| Simon> Nowhere. It's a name generated by GHC itself during
| Simon> compilation.
| Is there some way to recognise what the function is?
| The problem is with ESC/Haskell. I have managed to get the code
| integrated into the 6.11 tree, and it works up to a point.
| It produces output like:
| Len.pos does not satisfy its contract!
| Counter example:
| Len.pos with argument(s) x
| (Inside _GHC.Classes.>_ ( tpl_B6 )) x ((GHC.Types.I# 0))
| which is basically saying that it can't trust _GHC.Classes.>_ ( tpl_B6
| ) to do anything in particular, as it doesn't know anything about it.
| So it would be good to add code that recognises these functions. At
| best, to know the semantics of each one.
| Colin> | Where is a function with a name like the following
| Colin> defined in the ghc source | code?
| Colin> |
| Colin> | .Classes.>_ ( tpl_B6 )
| Colin Adams
| Preston Lancashire
More information about the Glasgow-haskell-users