
Yeah, definitely. Part of the reason why arrow notation is so frustrating
at the moment is because it forces everything into lambda calculus; that
is, it requires every category to be Cartesian Closed. When your arrow
category isn't Cartesian Closed, it raises two issues. 1) When it's not
Cartesian, you have to lie and say it supports products instead of tensors
(that is, you are able to get back the arguments of a product unchanged,
i.e. simple tuples), but this isn't the relevant part for Core. 2) When
it's not closed, you have to lie and say it supports higher order functions
(i.e., lambda abstractions applied to lambda abstractions) and implement
arr. Now, you can lie at the syntax level and typecheck it as kappa
calculus (i.e. first order functions only unless you are explicitly a
Closed category) but then say it is lambda calculus at the core level; this
would work because lambda calculus subsumes kappa calculus. This would
allow the optimiser/RULES etc to work unchanged. However, you would lose a
lot of the internal consistency checking usefulness of Core, and could miss
out on kappa-calculus-specific optimisations (although come to think of it,
call arity analysis might solve a lot of this issue).
On 22 October 2014 19:59, Simon Peyton Jones
Interesting. There is a pretty high bar for changes to Core itself. Currently arrow notation desugars into Core with no changes. If you want to change Core, then arrow “notation” is actually much more than syntactic sugar. Go for it – but it would be a much more foundational change than previously, and hence would require more motivation.
S
*From:* Sophie Taylor [mailto:sophie@traumapony.org] *Sent:* 22 October 2014 10:53 *To:* Simon Peyton Jones *Cc:* ghc-devs@haskell.org *Subject:* Re: Current description of Core?
Ah, thanks HEAPS. I've been banging my head against a wall for the last few days trying to see exactly what is going on :) I'm trying to find a way to minimise/eliminate the changes required to Core for the arrow notation rewrite - specifically, introducing kappa abstraction and application - semantically different to lambda abstraction/application but close enough that I can probably get away with either adding a simple flag to the Abstraction/Application constructors or doing it higher up in the HsExpr land, but the latter method leaves a sour taste in my mouth.
On 22 October 2014 19:35, Simon Peyton Jones
wrote: Is the current description of Core still System FC_2 (described in https://www.seas.upenn.edu/~sweirich/papers/popl163af-weirich.pdf)?
We never implemented that particular version (too complicated!).
This is the full current story (thanks to Richard for keeping it up to date), in the GHC source tree
:
https://ghc.haskell.org/trac/ghc/browser/ghc/docs/core-spec/core-spec.pdf
Simon
*From:* ghc-devs [mailto:ghc-devs-bounces@haskell.org] *On Behalf Of *Sophie Taylor *Sent:* 22 October 2014 10:26 *To:* ghc-devs@haskell.org *Subject:* Current description of Core?
Hi,
Is the current description of Core still System FC_2 (described in https://www.seas.upenn.edu/~sweirich/papers/popl163af-weirich.pdf)?