Any expression should be allowed to have an associated type annotation. Haskell has a similar feature using ::, e.g.
Since functions are lambdas assigned to a name, we would also want this for lambdas (as Haskell allows):
(\x -> x + 1) :: Int -> Int
However I think making it postfix would have poor usability:
inc = (x) -> { x + 1 } :: (Int) -> Int
Ergo, I would suggest using a prefix notation:
inc = (Int) -> Int :: (x) -> { x + 1 }
I'm not super in love with this either. Haskell also allows a "declaration" above a definition, which might work better:
inc :: (Int) -> Int
inc = (x) -> { x + 1 }
I think this is rather good, but with the requirement that all expressions may be typed, we would need multiple syntaxes. Maybe the former can be stylized:
inc = (Int) -> Int
:: (x) -> { x + 1 }
This could be acceptable.
Any expression should be allowed to have an associated type annotation. Haskell has a similar feature using
::, e.g.Since functions are lambdas assigned to a name, we would also want this for lambdas (as Haskell allows):
However I think making it postfix would have poor usability:
Ergo, I would suggest using a prefix notation:
I'm not super in love with this either. Haskell also allows a "declaration" above a definition, which might work better:
I think this is rather good, but with the requirement that all expressions may be typed, we would need multiple syntaxes. Maybe the former can be stylized:
This could be acceptable.