It turns out that Darcs never actually uses the full power of the GADTs
extension, that is, to restrict sum and products of some ADT *by
replacing some type variable by a concrete type* (see eg [1]).
Darcs' code does, however, restrict certain ADT by repeating the same
type variable:
-- | Forward lists
data FL a wX wZ where
(:>:) :: a wX wY -> FL a wY wZ -> FL a wX wZ
NilFL :: FL a wX wX
However (and to my surprise) this is handled already by the strictly
less poweful GADTSyntax extension (that exists since GHC 7.2) [2], which
now must be accompanied by ExistentialQuantification.
I haven't measured whether this change makes Darcs' compilation faster.
I hope so!
Anyway I think it is a good idea that we use the smallest language
extensions possible; when we need real GADTs we can activate them again.
[1] http://darcs.net/Internals/200801-ganesh-gadts.pdf
[2]
https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/glasgow_exts.html#declaring-data-types-with-explicit-constructor-signatures
1 patch for repository http://darcs.net:
patch 4fe172b29bfc4da016ec2f78c81c20a5f093f999
Author: Guillaume Hoffmann <guillaumh@gmail.com>
Date: Thu Feb 22 12:04:27 -03 2018
* replace GADTs extension by GADTSyntax and ExistentialQuantification
Attachments
|