... | ... | @@ -718,7 +718,7 @@ instanceGenericIntHashwheretypeRepIntHash=D1('MetaData"IntHash""Module""package" |
|
|
|
|
|
# Proposal: strictness metadata
|
|
|
|
|
|
[ Trac \#10716](https://ghc.haskell.org/trac/ghc/ticket/10716) proposes encoding metadata into the `Selector` class. Here is my take at implementing this.
|
|
|
[ Trac \#10716](https://ghc.haskell.org/trac/ghc/ticket/10716) proposes encoding metadata into the `Selector` class. Here is one take at implementing this.
|
|
|
|
|
|
## Add `selBang` to `Selector`
|
|
|
|
... | ... | @@ -739,7 +739,7 @@ dataT=T{-# UNPACK #-}!Int!IntIntderivingGeneric |
|
|
```
|
|
|
|
|
|
|
|
|
If we were to encode the source unpackedness and strictness of each of `T`'s fields, they were be `SourceUnpack`/`SourceStrict`, `NoSourceUnpackedness`/SourceStrict`, and `NoSourceUnpackedness`/`NoSourceStrictness\`, no matter what. Source unpackedness/strictness is a purely syntactic property.
|
|
|
If we were to encode the source unpackedness and strictness of each of `T`'s fields, they were be `SourceUnpack`/`SourceStrict`, `NoSourceUnpackedness`/`SourceStrict`, and `NoSourceUnpackedness`/`NoSourceStrictness`, no matter what. Source unpackedness/strictness is a purely syntactic property.
|
|
|
|
|
|
|
|
|
The strictness that the user writes, however, may be different from the strictness that GHC decides during compilation. For instance, if we were to compile `T` with no optimizations, the decided strictness of each field would be `DecidedStrict`, `DecidedStrict`, and `DecidedLazy`. If we enabled `-O2`, however, they would be `DecidedUnpack`, `DecidedStrict`, and `DecidedLazy`.
|
... | ... | |