[Git][ghc/ghc][wip/alpine-ci] 8 commits: Implement the -XUnliftedNewtypes extension.

Ben Gamari gitlab at gitlab.haskell.org
Sat Jun 15 02:15:50 UTC 2019



Ben Gamari pushed to branch wip/alpine-ci at Glasgow Haskell Compiler / GHC


Commits:
effdd948 by Andrew Martin at 2019-06-14T14:48:13Z
Implement the -XUnliftedNewtypes extension.

GHC Proposal: 0013-unlifted-newtypes.rst
Discussion: https://github.com/ghc-proposals/ghc-proposals/pull/98
Issues: #15219, #1311, #13595, #15883
Implementation Details:
  Note [Implementation of UnliftedNewtypes]
  Note [Unifying data family kinds]
  Note [Compulsory newtype unfolding]

This patch introduces the -XUnliftedNewtypes extension. When this
extension is enabled, GHC drops the restriction that the field in
a newtype must be of kind (TYPE 'LiftedRep). This allows types
like Int# and ByteArray# to be used in a newtype. Additionally,
coerce is made levity-polymorphic so that it can be used with
newtypes over unlifted types.

The bulk of the changes are in TcTyClsDecls.hs. With -XUnliftedNewtypes,
getInitialKind is more liberal, introducing a unification variable to
return the kind (TYPE r0) rather than just returning (TYPE 'LiftedRep).
When kind-checking a data constructor with kcConDecl, we attempt to
unify the kind of a newtype with the kind of its field's type. When
typechecking a data declaration with tcTyClDecl, we again perform a
unification. See the implementation note for more on this.

Co-authored-by: Richard Eisenberg <rae at richarde.dev>

- - - - -
5279dda8 by Ben Gamari at 2019-06-14T14:48:51Z
PrelRules: Don't break let/app invariant in shiftRule

Previously shiftRule would rewrite as invalid shift like
```
let x = I# (uncheckedIShiftL# n 80)
in ...
```
to
```
let x = I# (error "invalid shift")
in ...
```
However, this breaks the let/app invariant as `error` is not
okay-for-speculation. There isn't an easy way to avoid this so let's not
try. Instead we just take advantage of the undefined nature of invalid
shifts and return zero.

Fixes #16742.

- - - - -
227252c5 by Ben Gamari at 2019-06-15T02:15:00Z
base/Event/Poll: Drop POLLRDHUP enum item

Previously the Event enumeration produced by hsc2hs would sometimes
include a currently-unused POLLRDHUP item. This unused binding would
result in a build failure. Drop it.

- - - - -
99d08458 by Ben Gamari at 2019-06-15T02:15:00Z
testsuite: Fix T8602 on musl

Musl wants hash-bangs on all executables.

- - - - -
c9fe6251 by Ben Gamari at 2019-06-15T02:15:00Z
testsuite: Ensure T5423 flushes C output buffer

Previously T5423 would fail to flush the printf output buffer.
Consequently it was platform-dependent whether the C or Haskell print
output would be emitted first.

- - - - -
2d74366d by Ben Gamari at 2019-06-15T02:15:00Z
testsuite: Flush conc059's printf buffer

Otherwise it the order out the Haskell and C output will be
system-dependent.

- - - - -
fd84933f by Ben Gamari at 2019-06-15T02:15:00Z
testsuite: Ensure that ffi005 output order is predictable

The libc output buffer wasn't being flushed, making the order
system-depedent.

- - - - -
312ddc4c by Ben Gamari at 2019-06-15T02:15:00Z
gitlab-ci: Build alpine release bindists

- - - - -


30 changed files:

- .gitlab-ci.yml
- compiler/basicTypes/Id.hs
- compiler/basicTypes/MkId.hs
- compiler/codeGen/StgCmmForeign.hs
- compiler/coreSyn/CoreSyn.hs
- compiler/deSugar/DsExpr.hs
- compiler/hsSyn/HsTypes.hs
- compiler/main/DynFlags.hs
- compiler/main/TidyPgm.hs
- compiler/prelude/PrelRules.hs
- compiler/prelude/PrimOp.hs
- compiler/prelude/TysPrim.hs
- compiler/prelude/primops.txt.pp
- compiler/rename/RnSource.hs
- compiler/typecheck/TcErrors.hs
- compiler/typecheck/TcEvidence.hs
- compiler/typecheck/TcHsType.hs
- compiler/typecheck/TcInstDcls.hs
- compiler/typecheck/TcMType.hs
- compiler/typecheck/TcSimplify.hs
- compiler/typecheck/TcTyClsDecls.hs
- compiler/typecheck/TcTypeable.hs
- compiler/types/Coercion.hs
- compiler/types/Type.hs
- docs/users_guide/8.10.1-notes.rst
- docs/users_guide/glasgow_exts.rst
- libraries/base/Control/Category.hs
- libraries/base/Data/Coerce.hs
- libraries/base/Data/Type/Coercion.hs
- libraries/base/GHC/Base.hs


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/compare/bc5a72c105b37f94ab13af72bb9be2b7a1b35f6a...312ddc4cd1277ed4431ee8cbeaf64aebc69c73e1

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/compare/bc5a72c105b37f94ab13af72bb9be2b7a1b35f6a...312ddc4cd1277ed4431ee8cbeaf64aebc69c73e1
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20190614/015445e2/attachment.html>


More information about the ghc-commits mailing list