write initial type signature notation proposal #5

Merged
schrottkatze merged 3 commits from :type-notation into main 2024-01-11 14:55:57 +00:00
Showing only changes of commit 22a655fd24 - Show all commits

View file

@ -0,0 +1,23 @@
#import "../template.typ": conf
#show: doc => conf(
doc
)
multisamplednight marked this conversation as resolved

Can be simplified.

-#show doc => conf(
-    doc
-)
+#show: conf
Can be simplified. ```diff -#show doc => conf( - doc -) +#show: conf ```

Also I suggest adding a title and subtitle once #2 is merged.

Also I suggest adding a title and subtitle once https://forge.katzen.cafe/katzen-cafe/iowo/pulls/2 is merged.
= Type/signature notation
Operator signature that takes two unnamed arbitrary numbers of the same type and returns another:
`Op<T: Num> [ T T ] -> T`

Should be full codeblocks.

-`Op<T: Num> [ T T ] -> T`
+```iowo
+Op<T: Num> [ T T ] -> T
+```
Should be full codeblocks. ```diff -`Op<T: Num> [ T T ] -> T` +```iowo +Op<T: Num> [ T T ] -> T +``` ```
Operator that takes a 32 bit signed integer and returns another:
`Op i32 -> i32`
Operator that does the same with a generic arbitrary number type:
`Op<T: Num> T -> T`
One dimensional list of 32 bit signed integers:
`[i32]`
Due to inference, you'll also be able to use that in some mathematical operations with integers:
`[i32] + i32` is a valid operation, for example (of course, you can't add types.) But that wouldn't add the second one to the list, but rather add the single i32 to all values in the left hand side list). That would also work with more dimensional arrays and dynamic streams like videos.