What should be the type annotation of foo?
(define (foo)
(println "hello"))
I tried these but none of them worked:
(: foo (-> () ()))
(: foo (-> Void Void))
The type (-> Void Void) is for a function that takes in a void, and returns a void. Your foo function, takes in no arguments, and returns a void. As such, the type you want for it is actually:
(: foo (-> Void))
(define (foo)
(println "hello"))
As a side note:
If you wanted to modify foo to have the type (-> Void Void), you could do this:
(define (foo _)
(print "Don't do this though"))
As for:
(: foo (-> () ()))
That is syntactically invalid.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With