From baed978a1d69bf978e25aac503a0c40bd34e3718 Mon Sep 17 00:00:00 2001 From: LordBaryhobal Date: Thu, 9 Jul 2026 23:14:37 +0200 Subject: [PATCH] chore: remove syntax prototype examples --- .../00_syntax_prototype/01_simple_types.py | 15 ----- .../00_syntax_prototype/02_custom_types.midas | 63 ------------------- .../00_syntax_prototype/02_custom_types.py | 20 ------ examples/00_syntax_prototype/04_functions.py | 15 ----- .../05_custom_types_v3.midas | 33 ---------- 5 files changed, 146 deletions(-) delete mode 100644 examples/00_syntax_prototype/01_simple_types.py delete mode 100644 examples/00_syntax_prototype/02_custom_types.midas delete mode 100644 examples/00_syntax_prototype/02_custom_types.py delete mode 100644 examples/00_syntax_prototype/04_functions.py delete mode 100644 examples/00_syntax_prototype/05_custom_types_v3.midas diff --git a/examples/00_syntax_prototype/01_simple_types.py b/examples/00_syntax_prototype/01_simple_types.py deleted file mode 100644 index c974415..0000000 --- a/examples/00_syntax_prototype/01_simple_types.py +++ /dev/null @@ -1,15 +0,0 @@ -# type: ignore -# ruff: disable[F821] -from __future__ import annotations - -# A simple data-frame with different column of various simple types -# Columns can be named and/or typed -df: Frame[ - verified: bool, - birth_year: int, - height: float, - name: str, - date: object, - float, # unnamed - unknown: _, # untyped -] diff --git a/examples/00_syntax_prototype/02_custom_types.midas b/examples/00_syntax_prototype/02_custom_types.midas deleted file mode 100644 index 7b0336c..0000000 --- a/examples/00_syntax_prototype/02_custom_types.midas +++ /dev/null @@ -1,63 +0,0 @@ -// Simple custom type derived from float -type Custom = float - -// Simple custom types with constraints -type Latitude = float where (-90 <= _ & _ <= 90) -type Longitude = float where (-180 <= _ & _ <= 180) - -// Generic custom type (a Difference of T is derived from T, e.g. a difference of floats is a float -type Difference[T] = T - -// Complex custom type, containing two values accessible through properties -type GeoLocation = object - -extend GeoLocation { - prop lat: Latitude - prop lon: Longitude -} - -type GeoLocationDifference = object - -extend GeoLocationDifference { - prop lat: Difference[Latitude] - prop lon: Difference[Longitude] -} - -// Define operations on our custom type - -// Simple operation defined on our custom types -extend Latitude { - def __sub__: fn(Latitude, /) -> Difference[Latitude] -} - -extend Longitude { - def __sub__: fn(Longitude, /) -> Difference[Longitude] -} - -extend GeoLocation { - // This type is compatible with the `-` operation with another GeoLocation - // i.e. you can subtract a GeoLocation from another GeoLocation, resulting - // in a GeoLocationDifference - def __sub__: fn(GeoLocation, /) -> GeoLocationDifference -} - - -// Predefined custom predicates that can be referenced in other definitions -predicate Positive(v: float) = v >= 0 -predicate StrictlyPositive(v: float) = v > 0 -predicate Equatorial(loc: GeoLocation) = (-10 <= loc.lat <= 10) -predicate Arctic(loc: GeoLocation) = (loc.lat >= 66) - -type Person = object - -extend Person { - prop name: str - - // Property with an inline constraint - prop age: int where (0 <= _ & _ < 150) - - // Property referencing a predicate - prop height: float where StrictlyPositive(_) - - prop home: GeoLocation -} diff --git a/examples/00_syntax_prototype/02_custom_types.py b/examples/00_syntax_prototype/02_custom_types.py deleted file mode 100644 index e78d458..0000000 --- a/examples/00_syntax_prototype/02_custom_types.py +++ /dev/null @@ -1,20 +0,0 @@ -# type: ignore -# ruff: disable[F821] -from __future__ import annotations - -# A data-frame using a custom type -df: Frame[ - location: GeoLocation -] - -# Properties of a type can be used on a column of that type -lat: Column[Latitude] = ... -lon: Column[Longitude] = ... - -# Unregistered operations between types are not permitted -lat + lon # Invalid operation - -# Registered operations are permitted -lat1: Latitude = lat[0] -lat2: Latitude = lat[1] -lat_diff: Difference[Latitude] = lat2 - lat1 # Valid operation diff --git a/examples/00_syntax_prototype/04_functions.py b/examples/00_syntax_prototype/04_functions.py deleted file mode 100644 index 3b07899..0000000 --- a/examples/00_syntax_prototype/04_functions.py +++ /dev/null @@ -1,15 +0,0 @@ -# type: ignore -# ruff: disable[F821] -from __future__ import annotations - - -def func( - col1: Column[float + (0 <= _ <= 1)], - col2: Column[float + (0 <= _ <= 1)], -) -> Column[float + (0 <= _ <= 2)]: - result: Column[float + (0 <= _ <= 2)] = col1 + col2 - return result - - -def func2(a: int, /, b: float, *, c: str): - pass diff --git a/examples/00_syntax_prototype/05_custom_types_v3.midas b/examples/00_syntax_prototype/05_custom_types_v3.midas deleted file mode 100644 index a339318..0000000 --- a/examples/00_syntax_prototype/05_custom_types_v3.midas +++ /dev/null @@ -1,33 +0,0 @@ -type Foo1 = float -type Foo2 = float where (_ > 3) -type Foo3 = int | float -type Foo4 = int where (_ > 3) | float where (_ > 3) -type Foo5 = (int | float) where (_ > 3) -type Foo6 = { - foo: float - bar: float where (_ > 3) -} - -type Foo7[T] = T where (_ > 3) -type Foo8[A, B<:int] = { - a: A - b: B -} - -type Complex = { - a: int - b: int -} -type Complex2 = Complex where (_.a > 3 & _.b < 5) - -predicate Positive(n: int) = n >= 0 - -extend Foo1 { - op __add__(Foo1) -> Foo1 -} - -extend Foo7[T] { - op __add__(Foo7[T]) -> Foo7[T] -} - -type Optional[T] = None | T