-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Any expression should be allowed to have an associated type annotation. Haskell has a similar feature using ::, e.g.
(1 + 5) :: IntSince functions are lambdas assigned to a name, we would also want this for lambdas (as Haskell allows):
(\x -> x + 1) :: Int -> IntHowever 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.
Metadata
Metadata
Assignees
Labels
No labels