From d3d73fcde8b025aaa03cf8ae4a6b7f78bec92755 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20H=C3=BCbotter?= Date: Tue, 23 Mar 2021 10:34:37 +0100 Subject: [PATCH] [#565] Change type hint operator from as to :: --- common/enums.ts | 2 +- common/terms.ts | 2 +- tony/corpus/terms.txt | 11 +++++++++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/common/enums.ts b/common/enums.ts index 3ca00d99..b325ef12 100644 --- a/common/enums.ts +++ b/common/enums.ts @@ -3,7 +3,7 @@ export enum Prec { SubtractionType = -1, UnionType = 0, Assignment = 1, - TypeHint = 1, + TypeHint = 0, CurriedType = 1, NamedInfixApplication = 1, SectionIdentifier = 1, diff --git a/common/terms.ts b/common/terms.ts index 12c51dff..66c7aff9 100644 --- a/common/terms.ts +++ b/common/terms.ts @@ -472,7 +472,7 @@ export const type_hint = ( ) => prec.left( Prec.TypeHint, - seq(field('value', $._term), 'as', field('type', $._type)), + seq(field('value', $._term), '::', field('type', $._type)), ) export const hole = ($: GrammarSymbols) => diff --git a/tony/corpus/terms.txt b/tony/corpus/terms.txt index 52293255..30f64918 100644 --- a/tony/corpus/terms.txt +++ b/tony/corpus/terms.txt @@ -1084,7 +1084,8 @@ type GreaterThan(x :: T) = [y :: T | y > x] type hint ================== -'string' as String +'string' :: String +x :: Promise --- @@ -1092,7 +1093,13 @@ type hint term: (type_hint value: (string) type: (parametric_type - name: (type)))) + name: (type))) + term: (type_hint + value: (identifier) + type: (parametric_type + name: (type) + argument: (parametric_type + name: (type))))) ================== hole