... | ... | @@ -827,22 +827,17 @@ some things that may be non-obvious. |
|
|
monoLoc x = (g True , g 'v')
|
|
|
where
|
|
|
-- g :: b -> (a, String) -- This signature is ok
|
|
|
g :: b -> (a, _) -- -- This signature is not
|
|
|
g :: _ -- This signature is not
|
|
|
g y = (x, "foo")
|
|
|
```
|
|
|
|
|
|
This causes a panic (`ASSERT failed! file compiler/typecheck/TcBinds.lhs line 1198 g_alB`).
|
|
|
After disabling the failing assert, another assert fails, one checking the touchable invariant (`checkTouchableInvariant`). The
|
|
|
interaction of the function `tcPolyNoGen` in `TcBinds.lhs` with
|
|
|
partial type signatures must be fixed.
|
|
|
The example above will produce a number of errors of which the following is the vital one:
|
|
|
|
|
|
>
|
|
|
> A stopgap solution would be to signal an error saying this particular scenario is unsupported, which
|
|
|
> is not *that* common (see [ Section 4.3.1](http://research.microsoft.com/apps/pubs/default.aspx?id=162516) of
|
|
|
> *OutsideIn(X): Modular type inference with local assumptions*).
|
|
|
|
|
|
>
|
|
|
> We will look further into how to solve this, help is certainly welcome.
|
|
|
```wiki
|
|
|
Couldn't match expected type ‘Char -> (a, String)’
|
|
|
with actual type ‘_’
|
|
|
because type variable ‘a’ would escape its scope
|
|
|
```
|
|
|
|
|
|
1. TODO There is a bug in the handling of pattern bindings with partial type
|
|
|
signatures, i.e. the partial type signatures are ignored, e.g.
|
... | ... | @@ -944,22 +939,6 @@ some things that may be non-obvious. |
|
|
the type variable generated by generalising over the wildcard gets `w_` as
|
|
|
name, instead of the inverse. See test case `TidyClash2`.
|
|
|
|
|
|
1. There are two actual TODOs (I use TODOT to know it's one of my TODOs) in the code:
|
|
|
|
|
|
1. TODO In the function `insolubleWC :: WantedConstraints -> Bool`, in
|
|
|
`TcRnTypes.lhs`, `CHoleCan`s originating from a wildcard in a partial
|
|
|
type signature are ignored, as we want the constraint solver to solve
|
|
|
more constraints to report the correct inferred types. This is
|
|
|
not really a bug, but it looks like hack.
|
|
|
1. TODO In the `PatBind` case of `TcLhs` in `TcBinds.lhs`, no wildcard constraints are emitted.
|
|
|
This is related to the 2nd TODO.
|
|
|
|
|
|
1. TODO The user manual should be updated. We'll do this when the time
|
|
|
comes.
|
|
|
|
|
|
1. TODO We extended Haddock to support partial type signatures, but we
|
|
|
haven't been able to add tests to Haddock due to Cabal issues.
|
|
|
|
|
|
## Monomorphism restriction
|
|
|
|
|
|
|
... | ... | |