... | @@ -25,7 +25,7 @@ Whenever a situation arises in which a `RuntimeRep` must be monomorphic, we emit |
... | @@ -25,7 +25,7 @@ Whenever a situation arises in which a `RuntimeRep` must be monomorphic, we emit |
|
# Details
|
|
# Details
|
|
## Emitting FixedRuntimeRep constraints
|
|
## Emitting FixedRuntimeRep constraints
|
|
|
|
|
|
The whole point of emitting a `RuntimeRep` constraint is to allow the typechecker to determine whether the `RuntimeRep` is actually fixed (e.g. performing type-family reduction if necessary). When encountering a type `ty :: k`, to ensure it is representation-monomorphic, we require that `k` be of the form `TYPE r`. If we can immediately determine that `r` is a specific `RuntimeRep` (e.g. `IntRep`), we're done. Otherwise, we emit a `FixedRuntimeRep r` constraint.
|
|
The whole point of emitting a `RuntimeRep` constraint is to allow the typechecker to determine whether the `RuntimeRep` is actually fixed (e.g. performing type-family reduction if necessary). When encountering a type `ty :: k`, to ensure it is representation-monomorphic, we first require that `k` be of the form `TYPE r`. If we can immediately determine that `r` is a specific `RuntimeRep` (e.g. `IntRep`), we're done; oherwise, we emit a `FixedRuntimeRep r` constraint.
|
|
|
|
|
|
Note that we must look through type synonyms to avoid emitting `FixedRuntimeRep` constraints, in order to handle the common case `type Type = TYPE ('BoxedRep 'Lifted)`.
|
|
Note that we must look through type synonyms to avoid emitting `FixedRuntimeRep` constraints, in order to handle the common case `type Type = TYPE ('BoxedRep 'Lifted)`.
|
|
|
|
|
... | | ... | |