diff options
author | Andrei Barbu <andrei@0xab.com> | 2021-08-25 03:20:51 -0400 |
---|---|---|
committer | Andrei Barbu <andrei@0xab.com> | 2021-10-08 19:45:29 -0400 |
commit | a76409c758d8c7bd837dcc6c0b58f8cce656b4f1 (patch) | |
tree | 95dde306e370fe296ef84efa959828e8ecdd1267 /testsuite/tests/typecheck/should_compile | |
parent | 55a6377a5d55d6e6e93cf3d087f1e2d17fe7d3f3 (diff) | |
download | haskell-a76409c758d8c7bd837dcc6c0b58f8cce656b4f1.tar.gz |
Add defaulting plugins.
Like the built-in type defaulting rules these plugins can propose candidates
to resolve ambiguous type variables.
Machine learning and other large APIs like those for game engines introduce
new numeric types and other complex typed APIs. The built-in defaulting
mechanism isn't powerful enough to resolve ambiguous types in these cases forcing
users to specify minutia that they might not even know how to do. There is
an example defaulting plugin linked in the documentation. Applications include
defaulting the device a computation executes on, if a gradient should be
computed for a tensor, or the size of a tensor.
See https://github.com/ghc-proposals/ghc-proposals/pull/396 for details.
Diffstat (limited to 'testsuite/tests/typecheck/should_compile')
-rw-r--r-- | testsuite/tests/typecheck/should_compile/T10971a.stderr | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/testsuite/tests/typecheck/should_compile/T10971a.stderr b/testsuite/tests/typecheck/should_compile/T10971a.stderr index 800dc84efa..ff06f84bff 100644 --- a/testsuite/tests/typecheck/should_compile/T10971a.stderr +++ b/testsuite/tests/typecheck/should_compile/T10971a.stderr @@ -3,7 +3,7 @@ T10971a.hs:7:1: warning: [-Wmissing-signatures (in -Wall)] Top-level binding with no type signature: f :: [a] -> Int T10971a.hs:7:11: warning: [-Wtype-defaults (in -Wall)] - • Defaulting the following constraint to type ‘[]’ + • Defaulting the type variable ‘t0’ to type ‘[]’ in the following constraint Foldable t0 arising from a use of ‘length’ • In the expression: length x In the expression: \ x -> length x @@ -18,7 +18,7 @@ T10971a.hs:8:6: warning: [-Wname-shadowing (in -Wall)] defined at T10971a.hs:7:1 T10971a.hs:8:13: warning: [-Wtype-defaults (in -Wall)] - • Defaulting the following constraint to type ‘[]’ + • Defaulting the type variable ‘t0’ to type ‘[]’ in the following constraint Traversable t0 arising from a use of ‘fmapDefault’ • In the expression: fmapDefault f x In the expression: \ f x -> fmapDefault f x @@ -33,7 +33,7 @@ T10971a.hs:9:6: warning: [-Wname-shadowing (in -Wall)] defined at T10971a.hs:7:1 T10971a.hs:9:14: warning: [-Wtype-defaults (in -Wall)] - • Defaulting the following constraints to type ‘[]’ + • Defaulting the type variable ‘t0’ to type ‘[]’ in the following constraints (Traversable t0) arising from a use of ‘fmapDefault’ at T10971a.hs:9:14-24 (Foldable t0) arising from a use of ‘length’ at T10971a.hs:9:31-36 |