Skip to content

Commit 3fac6ab

Browse files
committed
Go over again
1 parent 47fbea7 commit 3fac6ab

File tree

1 file changed

+22
-28
lines changed
  • content/investigating-lang-ext-semantics

1 file changed

+22
-28
lines changed

content/investigating-lang-ext-semantics/index.md

Lines changed: 22 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -7,41 +7,33 @@ categories = ["Haskell Foundation"]
77
tags = ["Community", "Stability"]
88
+++
99

10-
We analyzed the [head.hackage](https://gitlab.haskell.org/ghc/head.hackage)[^head.hackage] patches to understand
10+
Hi I'm [Jappie](https://jappie.me) and I volunteer for the [Haskell Foundation Stability Working Group](https://blog.haskell.org/stability-working-group/).
11+
Recently we analyzed the [head.hackage](https://gitlab.haskell.org/ghc/head.hackage)[^head.hackage] patches to understand
1112
why code breaks on new GHC releases.
1213
"head.hackage" is a repository of patches for Hackage.
1314
GHC engineers use these to test out new GHC builds on a wide range of
1415
Hackage packages without having to upstream[^upstream] a patch, which can take time.
1516
Instead, they can put the patch in "head.hackage"
1617
and immediately test it on a wide range of packages.
1718
Surprisingly, most breakage wasn’t caused by
18-
Template Haskell—it came from deeper semantic changes in language extensions.
19+
[Template Haskell](https://ghc.gitlab.haskell.org/ghc/doc/users_guide/exts/template_haskell.html),
20+
it came from deeper semantic changes in language extensions.
21+
The meaning of (some) language extensions changed between GHC releases.
1922
This post walks through the main categories of breakage,
2023
why they happened, and what they tell us about long-term stability.
2124
If you care about a smoother upgrade path for Haskell users,
2225
we invite you to participate in the Stability Working Group.
2326

2427
[^upstream]: Upstreaming is the process of sending a patch to the “maintainers” of an open-source project. The maintainers will then make the patch ‘official’ by merging it. In principle, the process is simple, but in practice, the burden of proof (especially for larger projects) is on the person who submitted the patch. They have to convince the maintainers that the patch is useful, which takes time in the form of communication
2528

26-
The [Haskell Foundation Stability Working Group](https://blog.haskell.org/stability-working-group/)
27-
is interested in understanding
28-
why breakage occurs.
29-
This is an extension of our initial [investigation](https://jappie.me/analyzing-haskell-stability.html).
30-
We've recently done further analysis on [head.hackage](https://ghc.gitlab.haskell.org/head.hackage/),
29+
Extending our initial [investigation](https://jappie.me/analyzing-haskell-stability.html),
30+
We're also interested in understanding *why* breakage occurs.
31+
So we've recently done further analysis on [head.hackage](https://ghc.gitlab.haskell.org/head.hackage/),
3132
and learned surprisingly enough that the root cause
3233
of a lot of breakage isn't Template Haskell,
3334
but seems to be from language extension semantics[^meaning].
34-
We're doing this investigation to better understand where the Haskell
35-
Foundation stability working group should focus its efforts.
36-
About a year ago I started on analyzing the causes
37-
for all `head.hackage` patches, but I got bogged down
38-
by the sheer amount of work.
39-
Trevis suggested focusing on the
40-
most important question,
41-
why do language extension semantics cause so much breakage?
42-
So instead of being bogged down by analyzing all
43-
the patches, I just looked at the 12 patches from language extension
44-
semantics.
35+
We're doing this investigation to understand better where efforts
36+
should be focused in improving stability.
4537

4638
[^meaning]: The precise meaning of features enabled by language extensions. I guess parser changes also count.
4739

@@ -63,7 +55,7 @@ This gave us the following table:
6355
`th-compat-0.1.4.patch` was miscounted so I left that out.
6456
Simplified subsumption appears a lot but 3 are for Cabal,
6557
so it's only 2 real occurrences.
66-
We expect that to appear a lot however,
58+
I'd expect that to appear a lot however,
6759
because it was one of *the* motivating changes for a [stability working group](https://blog.haskell.org/stability-working-group/).
6860

6961
## Simplified subsumption
@@ -80,20 +72,22 @@ to do this under certain existential conditions:
8072
+ (withLexicalCallStack (\x -> uncurry action x))
8173

8274
```
83-
You've to insert a lambda, which apparently has some performance impact.
84-
This went wild with [Yesod stacks](https://www.yesodweb.com/book),
75+
You have to insert a lambda, which apparently has some performance impact.
76+
This had a big impact on [Yesod stacks](https://www.yesodweb.com/book),
8577
whose code generation helpfully created
8678
the database alias in the template:
8779
```diff
8880
type DB a = forall (m :: Type -> Type).
8981
(MonadUnliftIO m) => ReaderT SqlBackend m a
9082
```
9183

92-
So anything that now uses a query has to insert those lambdas,
93-
as you can imagine this would be in quite a few places for non-trivial commercial code bases.
94-
Which caused many issues for commercial users.
95-
You can just delete those aliases to solve the problem.
96-
Alternatively you can just enable the language extension: [DeepSubsumption](https://downloads.haskell.org/~ghc/9.12.2/docs/users_guide/exts/rank_polymorphism.html#extension-DeepSubsumption).
84+
Normally this is quite convenient,
85+
however with the simplified subsumption change,
86+
any code that interacts with the database now has to insert those lambdas.
87+
As you can imagine this would in many places for a commercial code base.
88+
Causing a lot of compile errors for industrial users.
89+
Instead of inserting lambdas, you can also delete those existential aliases to solve the problem.
90+
Or you can enable the language extension: [DeepSubsumption](https://downloads.haskell.org/~ghc/9.12.2/docs/users_guide/exts/rank_polymorphism.html#extension-DeepSubsumption).
9791
Which restores the original behavior.
9892

9993
## Moving of instances due to Template Haskell
@@ -208,8 +202,8 @@ and as a concept is used for type-level programming type safety.
208202

209203
## Conclusion
210204

211-
Often we experience these breakages as annoying and frustrating.
212-
However, if we look deeper, we find that each of them has
205+
Often these breakages are annoying and frustrating.
206+
But if we look deeper, we find that each of them has
213207
a little story
214208
and good reasons for being introduced.
215209
If you find this all as interesting as I do,

0 commit comments

Comments
 (0)