Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
research:software:gradual-unions [2017/05/02 10:43] – mtoro | research:software:gradual-unions [2017/05/02 10:58] – [Static and dynamic errors] mtoro | ||
---|---|---|---|
Line 159: | Line 159: | ||
- | ==== Errors | + | ==== Static and dynamic errors |
The prototype implementation reports static errors after the " | The prototype implementation reports static errors after the " | ||
- | {{: | + | {{: |
Now let us add an ascription to the boolean value: | Now let us add an ascription to the boolean value: | ||
Line 173: | Line 173: | ||
==== Combining gradual unions and the unknown type ==== | ==== Combining gradual unions and the unknown type ==== | ||
- | This is an example of combining the use of gradual unions and the unknown type. The applied lambda receives either a function that receives an Int, or a function that returns an Int. | + | This is an example of combining the use of gradual unions and the unknown type. The applied lambda receives either a function that receives an '' |
{{: | {{: | ||
- | This program, as we are passing a function from Int to Int the program run without errors. | + | This program |
Now consider the following program: | Now consider the following program: | ||
{{: | {{: | ||
- | This time we are passing as argument a function from Bool to Int, so the program also run without errors. | + | This time we are passing as argument a function from '' |
But if we consider this program: | But if we consider this program: | ||
Line 188: | Line 188: | ||
{{: | {{: | ||
- | We are now passing a function from Bool to Bool, so the program fails statically as (Int -> ?) + (? -> Int) is not consistent with Bool -> Bool. | + | We are now passing a function from '' |
If we add an ascription to the argument: | If we add an ascription to the argument: | ||
{{: | {{: | ||
- | Then the program typechecks but fails at runtime as it fails to justify that (Int -> ?) + (? -> Int) is consistent with Bool -> Bool. | + | Then the program typechecks but fails at runtime as it fails to justify that '' |