Idris2/tests/idris2/builtin010/expected
Zoe Stafford 1669fc351b
Refactor %builtin (#1803)
* Stub for future 'identity' optimisation
I plan to add this later, but I'm using for now for
NaturalToInteger and IntegerToNatural

* Refactor `%builtin`
fixes #1799

- automatically optimise all Natural shaped things
- NaturalToInteger and IntegerToNatural now use
  new `Identity` flag (internal use only for now)
  which signals the function is identity at runtime

* Use NaturalToInteger and IntegerToNatural for Nat and Fin
Also define show fin in terms of finToInteger, for speed

* Fix name handling for %builtin

* [ tests ] fixes + #1799

* remove %builtin from libs
Add back after next version

* Use resolved names where convenient
2021-08-03 14:19:17 +01:00

23 lines
589 B
Plaintext

1/1: Building Test (Test.idr)
Error: No unrestricted arguments of type `Integer` found for natToMyNat.
Test:20:1--20:37
16 | natToMyNat : Nat -> MyNat
17 | natToMyNat Z = Z
18 | natToMyNat (S k) = S $ natToMyNat k
19 |
20 | %builtin IntegerToNatural natToMyNat
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: Return type is not a 'Nat'-like type
Test:25:1--25:42
21 |
22 | integerToNotNat : Integer -> Maybe String
23 | integerToNotNat x = Just "Boo"
24 |
25 | %builtin IntegerToNatural integerToNotNat
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Main> Bye for now!