diff --git a/parser-typechecker/src/Unison/Runtime/IOSource.hs b/parser-typechecker/src/Unison/Runtime/IOSource.hs index 44f97a3b3..8ffa58c93 100644 --- a/parser-typechecker/src/Unison/Runtime/IOSource.hs +++ b/parser-typechecker/src/Unison/Runtime/IOSource.hs @@ -295,9 +295,9 @@ constructorName ref cid = source :: Text source = fromString [r| -type Either a b = Left a | Right b +structural type Either a b = Left a | Right b -type Optional a = None | Some a +structural type Optional a = None | Some a unique[b28d929d0a73d2c18eac86341a3bb9399f8550c11b5f35eabb2751e6803ccc20] type IsPropagated = IsPropagated @@ -462,7 +462,7 @@ unique[d7b2ced8c08b2c6e54050d1f5acedef3395f293d] type Pretty.Annotated w txt | Indent w (Pretty.Annotated w txt) (Pretty.Annotated w txt) (Pretty.Annotated w txt) | Append w [Pretty.Annotated w txt] -type Pretty txt = Pretty (Pretty.Annotated () txt) +structural type Pretty txt = Pretty (Pretty.Annotated () txt) Pretty.get = cases Pretty p -> p diff --git a/parser-typechecker/tests/Unison/Test/DataDeclaration.hs b/parser-typechecker/tests/Unison/Test/DataDeclaration.hs index 40824ecb5..1a11e24d0 100644 --- a/parser-typechecker/tests/Unison/Test/DataDeclaration.hs +++ b/parser-typechecker/tests/Unison/Test/DataDeclaration.hs @@ -38,23 +38,23 @@ test = scope "datadeclaration" $ file :: UnisonFile Symbol Ann file = flip unsafeParseFile Common.parsingEnv $ [r| -type Bool = True | False -type Bool' = False | True +structural type Bool = True | False +structural type Bool' = False | True -type Option a = Some a | None -type Option' b = Nothing | Just b +structural type Option a = Some a | None +structural type Option' b = Nothing | Just b -type List a = Nil | Cons a (List a) -type List' b = Prepend b (List' b) | Empty -type SnocList a = Snil | Snoc (List a) a +structural type List a = Nil | Cons a (List a) +structural type List' b = Prepend b (List' b) | Empty +structural type SnocList a = Snil | Snoc (List a) a -type ATree a = Tree a (List (ATree a)) | Leaf (Option a) +structural type ATree a = Tree a (List (ATree a)) | Leaf (Option a) -type Ping a = Ping a (Pong a) -type Pong a = Pnong | Pong (Ping a) +structural type Ping a = Ping a (Pong a) +structural type Pong a = Pnong | Pong (Ping a) -type Long' a = Long' (Ling' a) | Lnong -type Ling' a = Ling' a (Long' a) +structural type Long' a = Long' (Ling' a) | Lnong +structural type Ling' a = Ling' a (Long' a) |] diff --git a/parser-typechecker/tests/Unison/Test/FileParser.hs b/parser-typechecker/tests/Unison/Test/FileParser.hs index f45a6298a..7120aa447 100644 --- a/parser-typechecker/tests/Unison/Test/FileParser.hs +++ b/parser-typechecker/tests/Unison/Test/FileParser.hs @@ -18,25 +18,25 @@ module Unison.Test.FileParser where test1 = scope "test1" . tests . map parses $ [ -- , "type () = ()\n()" - "type Pair a b = Pair a b\n" - , "type Optional a = Just a | Nothing\n" + "structural type Pair a b = Pair a b\n" + , "structural type Optional a = Just a | Nothing\n" , unlines - ["type Optional2 a" + ["structural type Optional2 a" ," = Just a" ," | Nothing\n"] ------ -- ,unlines - ------ -- ["type Optional a b c where" + ------ -- ["structural type Optional a b c where" ------ -- ," Just : a -> Optional a" ------ -- ," Nothing : Optional Int"] ------ -- , unlines - ------ -- ["type Optional" + ------ -- ["structural type Optional" ------ -- ," a" ------ -- ," b" ------ -- ," c where" ------ -- ," Just : a -> Optional a" ------ -- ," Nothing : Optional Int"] , unlines -- NB: this currently fails because we don't have type AST or parser for effect types yet - ["ability State s where" + ["structural ability State s where" ," get : {State s} s" ," set : s -> {State s} ()" ] diff --git a/parser-typechecker/tests/Unison/Test/GitSync.hs b/parser-typechecker/tests/Unison/Test/GitSync.hs index a5b4fe88d..767616ce7 100644 --- a/parser-typechecker/tests/Unison/Test/GitSync.hs +++ b/parser-typechecker/tests/Unison/Test/GitSync.hs @@ -249,7 +249,7 @@ test = scope "gitsync22" . tests $ -- simplest-author (\repo -> [i| ```unison - type Foo = Foo + structural type Foo = Foo ``` ```ucm .myLib> debug.file @@ -322,8 +322,8 @@ test = scope "gitsync22" . tests $ .> builtins.merge ``` ```unison - type A = A Nat - type B = B Int + structural type A = A Nat + structural type B = B Int x = 3 y = 4 ``` diff --git a/parser-typechecker/tests/Unison/Test/Typechecker/TypeError.hs b/parser-typechecker/tests/Unison/Test/Typechecker/TypeError.hs index 5c4b90adb..60ce8f6c6 100644 --- a/parser-typechecker/tests/Unison/Test/Typechecker/TypeError.hs +++ b/parser-typechecker/tests/Unison/Test/Typechecker/TypeError.hs @@ -32,7 +32,7 @@ test = scope "> extractor" . tests $ , n "> match 3 with 3 | 3 -> 3" Err.matchBody , y "> 1 1" Err.applyingNonFunction , y "> 1 Int.+ 1" Err.applyingFunction - , y ( "ability Abort where\n" ++ + , y ( "structural ability Abort where\n" ++ " abort : {Abort} a\n" ++ "\n" ++ "xyz : t -> Request Abort t -> t\n" ++ diff --git a/unison-src/Base.u b/unison-src/Base.u index a724a4330..98ca0138e 100644 --- a/unison-src/Base.u +++ b/unison-src/Base.u @@ -154,7 +154,7 @@ List.diagonal = -- -- Use binary search to do lookups and find insertion points -- -- This relies on the underlying sequence having efficient -- -- slicing and concatenation -type Map k v = Map [k] [v] +structural type Map k v = Map [k] [v] -- use Map Map @@ -314,7 +314,7 @@ Multimap.insert k v m = match Map.lookup k m with Multimap.lookup : k -> Map k [v] -> [v] Multimap.lookup k m = Optional.orDefault [] (Map.lookup k m) -type Set a = Set (Map a ()) +structural type Set a = Set (Map a ()) Set.empty : Set k Set.empty = Set Map.empty @@ -346,7 +346,7 @@ Set.size s = Map.size (underlying s) Set.intersect : Set k -> Set k -> Set k Set.intersect s1 s2 = Set (Map.intersect (underlying s1) (underlying s2)) -type Heap k v = Heap Nat k v [Heap k v] +structural type Heap k v = Heap Nat k v [Heap k v] Heap.singleton : k -> v -> Heap k v Heap.singleton k v = Heap 1 k v [] diff --git a/unison-src/demo/1.u b/unison-src/demo/1.u index 02ccb456d..807db0316 100644 --- a/unison-src/demo/1.u +++ b/unison-src/demo/1.u @@ -2,5 +2,4 @@ increment : Nat -> Nat increment n = n + 1 > x = 1 + 40 -> increment x - +> increment x \ No newline at end of file diff --git a/unison-src/errors/X-array.u b/unison-src/errors/X-array.u index 632361719..9d5d69530 100644 --- a/unison-src/errors/X-array.u +++ b/unison-src/errors/X-array.u @@ -1,4 +1,4 @@ -type X = S Text | I Nat +structural type X = S Text | I Nat foo : a -> b -> c -> X foo x y z = X.S "" diff --git a/unison-src/errors/abort-ability-checks-against-pure.u b/unison-src/errors/abort-ability-checks-against-pure.u index 1d41bf7a1..9f8c87ae6 100644 --- a/unison-src/errors/abort-ability-checks-against-pure.u +++ b/unison-src/errors/abort-ability-checks-against-pure.u @@ -1,5 +1,5 @@ --Abort -ability Abort where +structural ability Abort where Abort : forall a . () -> {Abort} a bork = u -> 1 + (Abort.Abort ()) diff --git a/unison-src/errors/all-errors.u b/unison-src/errors/all-errors.u index 91d44a3e7..ccf865a8a 100644 --- a/unison-src/errors/all-errors.u +++ b/unison-src/errors/all-errors.u @@ -1,9 +1,9 @@ -type Optional a = Some a | None +structural type Optional a = Some a | None -ability Abort where +structural ability Abort where Abort : forall a . () -> {Abort} a -ability Abort2 where +structural ability Abort2 where Abort2 : forall a . () -> {Abort2} a Abort2' : forall a . () -> {Abort2} a diff --git a/unison-src/errors/check-for-regressions/lens.u b/unison-src/errors/check-for-regressions/lens.u index 9a4e4b1cd..eed7ed900 100644 --- a/unison-src/errors/check-for-regressions/lens.u +++ b/unison-src/errors/check-for-regressions/lens.u @@ -1,4 +1,4 @@ -type Foo a b = Foo a b +structural type Foo a b = Foo a b use Foo Foo use Optional Some setA : Foo a b -> Optional a -> Foo a b diff --git a/unison-src/errors/effect-inference1.u b/unison-src/errors/effect-inference1.u index d65321e99..dac87a3a0 100644 --- a/unison-src/errors/effect-inference1.u +++ b/unison-src/errors/effect-inference1.u @@ -1,4 +1,4 @@ -ability Abort where +structural ability Abort where Abort : forall a . () -> {Abort} a foo n = if n >= 1000 then n else !Abort.Abort diff --git a/unison-src/errors/effect_unknown_type.uu b/unison-src/errors/effect_unknown_type.uu index 37fb492e4..f8ff89919 100755 --- a/unison-src/errors/effect_unknown_type.uu +++ b/unison-src/errors/effect_unknown_type.uu @@ -1,4 +1,4 @@ -ability T where +structural ability T where a : Unknown -> {T} () --b : Unknown diff --git a/unison-src/errors/handle-inference.u b/unison-src/errors/handle-inference.u index 8d5dc87c7..24354124b 100644 --- a/unison-src/errors/handle-inference.u +++ b/unison-src/errors/handle-inference.u @@ -1,5 +1,5 @@ --handle inference -ability State s where +structural ability State s where get : ∀ s . () -> {State s} s set : ∀ s . s -> {State s} () state : ∀ a s . s -> Request (State s) a -> a diff --git a/unison-src/errors/handler-coverage-checking.uu b/unison-src/errors/handler-coverage-checking.uu index 134519ef0..fe22fb9b0 100644 --- a/unison-src/errors/handler-coverage-checking.uu +++ b/unison-src/errors/handler-coverage-checking.uu @@ -1,5 +1,5 @@ --State3 ability -ability State se2 where +structural ability State se2 where put : ∀ se . se -> {State se} () get : ∀ se . () -> {State se} se diff --git a/unison-src/errors/io-effect.u b/unison-src/errors/io-effect.u index 737316353..f11aad5ea 100644 --- a/unison-src/errors/io-effect.u +++ b/unison-src/errors/io-effect.u @@ -1,5 +1,5 @@ --IO ability -ability IO where +structural ability IO where launchMissiles : () -> {IO} () -- binding is not guarded by a lambda, it only can access -- ambient abilities (which will be empty) diff --git a/unison-src/errors/io-state1.u b/unison-src/errors/io-state1.u index a9d1c11c6..f37b64402 100644 --- a/unison-src/errors/io-state1.u +++ b/unison-src/errors/io-state1.u @@ -1,7 +1,7 @@ --IO/State1 ability -ability IO where +structural ability IO where launchMissiles : {IO} () -ability State se2 where +structural ability State se2 where put : ∀ se . se -> {State se} () get : ∀ se . () -> {State se} se foo : () -> {IO} () diff --git a/unison-src/errors/map-traverse3.u b/unison-src/errors/map-traverse3.u index 724a5bdee..8db0f0d03 100644 --- a/unison-src/errors/map-traverse3.u +++ b/unison-src/errors/map-traverse3.u @@ -1,8 +1,8 @@ --map/traverse -ability Noop where +structural ability Noop where noop : a -> {Noop} a -type List a = Nil | Cons a (List a) +structural type List a = Nil | Cons a (List a) map : (a ->{} b) -> List a -> List b map f = cases diff --git a/unison-src/errors/need-nominal-type.uu b/unison-src/errors/need-nominal-type.uu index 14b48ed3c..f110f17b9 100644 --- a/unison-src/errors/need-nominal-type.uu +++ b/unison-src/errors/need-nominal-type.uu @@ -1,5 +1,5 @@ -type Foo = Foo -type Bar = Bar +structural type Foo = Foo +structural type Bar = Bar x : Foo x = Bar.Bar diff --git a/unison-src/errors/poor-error-message/handle.u b/unison-src/errors/poor-error-message/handle.u index 6f476f689..baa69403f 100644 --- a/unison-src/errors/poor-error-message/handle.u +++ b/unison-src/errors/poor-error-message/handle.u @@ -5,9 +5,9 @@ -- 27 | let -- -type Optional a = None | Some a +structural type Optional a = None | Some a -ability State s where +structural ability State s where put : s -> {State s} () get : {State s} s diff --git a/unison-src/errors/poor-error-message/handler-ex.u b/unison-src/errors/poor-error-message/handler-ex.u index 9e07c1262..94c5129b0 100644 --- a/unison-src/errors/poor-error-message/handler-ex.u +++ b/unison-src/errors/poor-error-message/handler-ex.u @@ -11,7 +11,7 @@ -- -- Verbiage could be improved, but also the `()` location should -- point to line 22, the `k ()` call. -ability Ask foo where +structural ability Ask foo where ask : () -> {Ask a} a supply : Text -> Request (Ask Text) a -> a diff --git a/unison-src/errors/poor-error-message/mismatched-case-result-types.u b/unison-src/errors/poor-error-message/mismatched-case-result-types.u index e1dd52047..aa0248778 100644 --- a/unison-src/errors/poor-error-message/mismatched-case-result-types.u +++ b/unison-src/errors/poor-error-message/mismatched-case-result-types.u @@ -1,5 +1,5 @@ --mismatched case result types -type Optional a = None | Some a +structural type Optional a = None | Some a match Optional.Some 3 with x -> 1 y -> "boo" diff --git a/unison-src/errors/poor-error-message/notaguard.u b/unison-src/errors/poor-error-message/notaguard.u index 54c3f0e37..8c38d0783 100644 --- a/unison-src/errors/poor-error-message/notaguard.u +++ b/unison-src/errors/poor-error-message/notaguard.u @@ -10,7 +10,7 @@ -- -- even though this program doesn't use guards! -ability Ask a where +structural ability Ask a where ask : {Ask a} a supply : Text -> Request (Ask Text) a -> a diff --git a/unison-src/errors/poor-error-message/overapplied-data-constructor-loc.u b/unison-src/errors/poor-error-message/overapplied-data-constructor-loc.u index 4f9b25c32..d5e453673 100644 --- a/unison-src/errors/poor-error-message/overapplied-data-constructor-loc.u +++ b/unison-src/errors/poor-error-message/overapplied-data-constructor-loc.u @@ -1,7 +1,7 @@ -- board piece -type P = X | O | E +structural type P = X | O | E -type Board = Board P P +structural type Board = Board P P use Board.Board use P O X E diff --git a/unison-src/errors/poor-error-message/pattern-matching-1.u b/unison-src/errors/poor-error-message/pattern-matching-1.u index 2e53532d3..307d94b6c 100644 --- a/unison-src/errors/poor-error-message/pattern-matching-1.u +++ b/unison-src/errors/poor-error-message/pattern-matching-1.u @@ -1,7 +1,7 @@ -type Foo0 = Foo0 -type Foo1 a = Foo1 a -type Foo2 a b = Foo2 a b -type Foo3 a b c = Foo3 a b c +structural type Foo0 = Foo0 +structural type Foo1 a = Foo1 a +structural type Foo2 a b = Foo2 a b +structural type Foo3 a b c = Foo3 a b c use Foo0 Foo0 use Foo1 Foo1 diff --git a/unison-src/errors/state4.u b/unison-src/errors/state4.u index b4890f65e..82b859a75 100644 --- a/unison-src/errors/state4.u +++ b/unison-src/errors/state4.u @@ -1,5 +1,5 @@ --State4 ability -ability State se2 where +structural ability State se2 where put : ∀ se . se -> {State se} () get : ∀ se . () -> {State se} se -- binding is not guarded by a lambda, it only can access diff --git a/unison-src/errors/term-functor-inspired/effect1.u b/unison-src/errors/term-functor-inspired/effect1.u index 1c3f007c3..b07263784 100644 --- a/unison-src/errors/term-functor-inspired/effect1.u +++ b/unison-src/errors/term-functor-inspired/effect1.u @@ -1,4 +1,4 @@ -ability State s where +structural ability State s where get : () -> {State s} s set : s -> {State s} () diff --git a/unison-src/errors/term-functor-inspired/mismatched-case-result-types.u b/unison-src/errors/term-functor-inspired/mismatched-case-result-types.u index 3aed71fd9..e72f3be97 100644 --- a/unison-src/errors/term-functor-inspired/mismatched-case-result-types.u +++ b/unison-src/errors/term-functor-inspired/mismatched-case-result-types.u @@ -1,5 +1,5 @@ --mismatched case result types -type Optional a = None | Some a +structural type Optional a = None | Some a match Optional.Some 3 with x -> 1 y -> "boo" diff --git a/unison-src/errors/type-apply.u b/unison-src/errors/type-apply.u index c44b88224..ed179147c 100644 --- a/unison-src/errors/type-apply.u +++ b/unison-src/errors/type-apply.u @@ -1,5 +1,5 @@ --Type.apply -type List a = Nil | Cons a (List a) +structural type List a = Nil | Cons a (List a) map : ∀ a b . (a -> b) -> List a -> List b map f = cases List.Nil -> List.Nil diff --git a/unison-src/errors/type-functor-inspired/app2.u b/unison-src/errors/type-functor-inspired/app2.u index b9b422b84..2e9c3e9a4 100644 --- a/unison-src/errors/type-functor-inspired/app2.u +++ b/unison-src/errors/type-functor-inspired/app2.u @@ -1,4 +1,4 @@ -type Optional a = Some a | None +structural type Optional a = Some a | None app' : Optional Int app' = 3 () diff --git a/unison-src/errors/type-functor-inspired/effect2.u b/unison-src/errors/type-functor-inspired/effect2.u index 90615b8ea..1ba2444cc 100644 --- a/unison-src/errors/type-functor-inspired/effect2.u +++ b/unison-src/errors/type-functor-inspired/effect2.u @@ -1,7 +1,7 @@ -ability Abort where +structural ability Abort where Abort : forall a . () -> {Abort} a -ability Abort2 where +structural ability Abort2 where Abort2 : forall a . () -> {Abort2} a Abort2' : forall a . () -> {Abort2} a diff --git a/unison-src/errors/type-functor-inspired/need-nonstructural-types.uu b/unison-src/errors/type-functor-inspired/need-nonstructural-types.uu index dc731e635..a2ad932a7 100644 --- a/unison-src/errors/type-functor-inspired/need-nonstructural-types.uu +++ b/unison-src/errors/type-functor-inspired/need-nonstructural-types.uu @@ -1,7 +1,7 @@ -ability Abort where +structural ability Abort where Abort : forall a . () -> {Abort} a -ability Abort2 where +structural ability Abort2 where Abort2 : forall a . () -> {Abort2} a ability' : Nat -> { Abort } Int diff --git a/unison-src/errors/type-functor-inspired/parens.u b/unison-src/errors/type-functor-inspired/parens.u index 22d02da2d..8d230bb0d 100644 --- a/unison-src/errors/type-functor-inspired/parens.u +++ b/unison-src/errors/type-functor-inspired/parens.u @@ -1,4 +1,4 @@ -type Optional a = Some a | None +structural type Optional a = Some a | None y : (Optional Int) y = 3 () \ No newline at end of file diff --git a/unison-src/errors/type-functor-inspired/subtuple.u b/unison-src/errors/type-functor-inspired/subtuple.u index f1aab6f7f..a8d884af6 100644 --- a/unison-src/errors/type-functor-inspired/subtuple.u +++ b/unison-src/errors/type-functor-inspired/subtuple.u @@ -1,4 +1,4 @@ -type Optional a = Some a | None +structural type Optional a = Some a | None z' : (Optional Int, Optional Text, Optional Float) z' = (None, 3) diff --git a/unison-src/errors/type-functor-inspired/tuple.u b/unison-src/errors/type-functor-inspired/tuple.u index e7f0019f7..1e957855c 100644 --- a/unison-src/errors/type-functor-inspired/tuple.u +++ b/unison-src/errors/type-functor-inspired/tuple.u @@ -1,4 +1,4 @@ -type Optional a = Some a | None +structural type Optional a = Some a | None z : (Optional Int, Optional Text, Optional Float) z = 3 () \ No newline at end of file diff --git a/unison-src/errors/unexpected-loop.u b/unison-src/errors/unexpected-loop.u index 16cada089..175fe1df6 100644 --- a/unison-src/errors/unexpected-loop.u +++ b/unison-src/errors/unexpected-loop.u @@ -1,5 +1,5 @@ --Abort -ability Abort where +structural ability Abort where Abort : forall a . () -> {Abort} a use Nat + diff --git a/unison-src/errors/unsound-cont.u b/unison-src/errors/unsound-cont.u index f05745d9f..b9d14d116 100644 --- a/unison-src/errors/unsound-cont.u +++ b/unison-src/errors/unsound-cont.u @@ -1,5 +1,5 @@ -ability Ask a where +structural ability Ask a where ask : {Ask a} a supply : Text -> Request (Ask Text) a -> a diff --git a/unison-src/tests/344.uu b/unison-src/tests/344.uu index 6749329c2..32c12664d 100644 --- a/unison-src/tests/344.uu +++ b/unison-src/tests/344.uu @@ -1,5 +1,5 @@ -ability Either a b where +structural ability Either a b where left : a -> {Either a b} () right : b -> {Either a b} () -type Either a b = Left a | Right b +structural type Either a b = Left a | Right b diff --git a/unison-src/tests/595.u b/unison-src/tests/595.u index b6383b6b5..d8a4eb18f 100644 --- a/unison-src/tests/595.u +++ b/unison-src/tests/595.u @@ -1,5 +1,5 @@ -type Any = Any (∀ r . (∀ a . a -> r) -> r) +structural type Any = Any (∀ r . (∀ a . a -> r) -> r) -- also typechecks as expected any : a -> Any diff --git a/unison-src/tests/868.u b/unison-src/tests/868.u index 21cef2773..51866a219 100644 --- a/unison-src/tests/868.u +++ b/unison-src/tests/868.u @@ -1,5 +1,5 @@ -type Choice = First | Second -type Wrapper = Wrapper Choice +structural type Choice = First | Second +structural type Wrapper = Wrapper Choice broken = match Wrapper.Wrapper Choice.Second with Wrapper.Wrapper Choice.First -> true diff --git a/unison-src/tests/a-tale-of-two-optionals.u b/unison-src/tests/a-tale-of-two-optionals.u index d91fafa6e..40489216b 100644 --- a/unison-src/tests/a-tale-of-two-optionals.u +++ b/unison-src/tests/a-tale-of-two-optionals.u @@ -1,4 +1,4 @@ -type Optional a = None | Some a +structural type Optional a = None | Some a Optional.isEmpty : Optional a -> Boolean Optional.isEmpty = cases diff --git a/unison-src/tests/ability-inference-fail.uu b/unison-src/tests/ability-inference-fail.uu index e0dfbf2d7..d09a8dadd 100644 --- a/unison-src/tests/ability-inference-fail.uu +++ b/unison-src/tests/ability-inference-fail.uu @@ -1,7 +1,7 @@ -ability Emit a where +structural ability Emit a where emit : a ->{Emit a} () -type Stream a = Stream ('{Emit a} ()) +structural type Stream a = Stream ('{Emit a} ()) use Stream Stream use Optional None Some diff --git a/unison-src/tests/ability-keyword.u b/unison-src/tests/ability-keyword.u index afe11e7a9..f0c4ad8a0 100644 --- a/unison-src/tests/ability-keyword.u +++ b/unison-src/tests/ability-keyword.u @@ -1,7 +1,6 @@ - -ability Foo where +structural ability Foo where foo : {Foo} Text x = 'let y = Foo.foo - () + () \ No newline at end of file diff --git a/unison-src/tests/abort.u b/unison-src/tests/abort.u index f5649ac45..a6e9fd8d2 100644 --- a/unison-src/tests/abort.u +++ b/unison-src/tests/abort.u @@ -1,5 +1,5 @@ --Abort -ability Abort where +structural ability Abort where Abort : forall a . () -> {Abort} a eff : forall a b . (a -> b) -> b -> Request Abort a -> b eff f z = cases diff --git a/unison-src/tests/ask-inferred.u b/unison-src/tests/ask-inferred.u index 266eb12e2..387ab27db 100644 --- a/unison-src/tests/ask-inferred.u +++ b/unison-src/tests/ask-inferred.u @@ -1,14 +1,14 @@ --Ask inferred -ability Ask a where +structural ability Ask a where ask : {Ask a} a -ability AskU where +structural ability AskU where ask : {AskU} Nat use Nat + -ability AskT where +structural ability AskT where ask : {AskT} Text x = '(Ask.ask + 1) diff --git a/unison-src/tests/cce.u b/unison-src/tests/cce.u index f7bb08472..de53c5696 100644 --- a/unison-src/tests/cce.u +++ b/unison-src/tests/cce.u @@ -1,9 +1,9 @@ use Universal < -type Future a = Future ('{Remote} a) +structural type Future a = Future ('{Remote} a) -- A simple distributed computation ability -ability Remote where +structural ability Remote where -- Spawn a new node spawn : {Remote} Node @@ -16,7 +16,7 @@ ability Remote where -- await the result of the computation fork : '{Remote} a ->{Remote} Future a -type Node = Node Nat -- more realistic would be perhaps a (Hostname, PublicKey) pair +structural type Node = Node Nat -- more realistic would be perhaps a (Hostname, PublicKey) pair force : Future a ->{Remote} a force = cases Future.Future r -> !r @@ -51,7 +51,7 @@ List.map f as = Some a -> go f (acc `snoc` f a) as (i + 1) go f [] as 0 -type Monoid a = Monoid (a -> a -> a) a +structural type Monoid a = Monoid (a -> a -> a) a Monoid.zero = cases Monoid.Monoid op z -> z Monoid.op = cases Monoid.Monoid op z -> op diff --git a/unison-src/tests/console.u b/unison-src/tests/console.u index 881c2ed15..a8f079227 100644 --- a/unison-src/tests/console.u +++ b/unison-src/tests/console.u @@ -1,8 +1,8 @@ -ability State s where +structural ability State s where get : {State s} s set : s -> {State s} () -ability Console where +structural ability Console where read : {Console} (Optional Text) write : Text -> {Console} () diff --git a/unison-src/tests/console1.u b/unison-src/tests/console1.u index c29d7b7eb..71fc616d0 100644 --- a/unison-src/tests/console1.u +++ b/unison-src/tests/console1.u @@ -1,11 +1,11 @@ -- This confusingly gives an error that -- it doesn't know what `Console.simulate` is. -ability State s where +structural ability State s where get : {State s} s set : s -> {State s} () -ability Console where +structural ability Console where read : {Console} (Optional Text) write : Text -> {Console} () diff --git a/unison-src/tests/data-references-builtins.u b/unison-src/tests/data-references-builtins.u index 099ef4e28..80d6ea7dc 100644 --- a/unison-src/tests/data-references-builtins.u +++ b/unison-src/tests/data-references-builtins.u @@ -1,4 +1,4 @@ --data references builtins -type StringOrInt = S Text | I Nat +structural type StringOrInt = S Text | I Nat > [StringOrInt.S "YO", StringOrInt.I 1] diff --git a/unison-src/tests/delay.u b/unison-src/tests/delay.u index 0935bbabb..f40e9ed99 100644 --- a/unison-src/tests/delay.u +++ b/unison-src/tests/delay.u @@ -1,5 +1,5 @@ -type Foo a = Foo a +structural type Foo a = Foo a (+) = (Nat.+) diff --git a/unison-src/tests/delay_parse.u b/unison-src/tests/delay_parse.u index 525f62eaa..cf7b6e569 100644 --- a/unison-src/tests/delay_parse.u +++ b/unison-src/tests/delay_parse.u @@ -1,4 +1,4 @@ -ability T where +structural ability T where foo : {T} () -- parses fine diff --git a/unison-src/tests/effect-instantiation.u b/unison-src/tests/effect-instantiation.u index 5ec6e1679..6ef57c7cf 100644 --- a/unison-src/tests/effect-instantiation.u +++ b/unison-src/tests/effect-instantiation.u @@ -2,7 +2,7 @@ blah : a -> a -> a blah a a2 = a2 -ability Foo where +structural ability Foo where foo : {Foo} Text -- previously this didn't work as first argument was pure diff --git a/unison-src/tests/effect-instantiation2.u b/unison-src/tests/effect-instantiation2.u index 6a12abb9a..a47aea5aa 100644 --- a/unison-src/tests/effect-instantiation2.u +++ b/unison-src/tests/effect-instantiation2.u @@ -2,7 +2,7 @@ woot : a -> a -> a woot a a2 = a -ability Hi where +structural ability Hi where hi : Float ->{Hi} Int > woot Float.floor Hi.hi diff --git a/unison-src/tests/effect1.u b/unison-src/tests/effect1.u index 81c772401..aa0c2135d 100644 --- a/unison-src/tests/effect1.u +++ b/unison-src/tests/effect1.u @@ -4,5 +4,5 @@ eff f z = cases { Abort.Abort _ -> k } -> z { a } -> f a -ability Abort where +structural ability Abort where Abort : forall a . () -> {Abort} a diff --git a/unison-src/tests/fix1185.u b/unison-src/tests/fix1185.u index a897cc17f..0cea2dc59 100644 --- a/unison-src/tests/fix1185.u +++ b/unison-src/tests/fix1185.u @@ -8,7 +8,7 @@ -- This file won't typecheck unless the definitions get -- the correct inferred types. -ability Zonk where +structural ability Zonk where zonk : Nat -- should be inferred as: diff --git a/unison-src/tests/fix1695.u b/unison-src/tests/fix1695.u index a605acf2e..91fdb5762 100644 --- a/unison-src/tests/fix1695.u +++ b/unison-src/tests/fix1695.u @@ -1,5 +1,5 @@ -ability G a where +structural ability G a where get : a f x y = diff --git a/unison-src/tests/fix528.u b/unison-src/tests/fix528.u index c0dff14ec..b93591ff1 100644 --- a/unison-src/tests/fix528.u +++ b/unison-src/tests/fix528.u @@ -4,7 +4,7 @@ a |> f = f a ex1 = "bob" |> (Text.++) "hi, " -type Woot = Woot Text Int Nat +structural type Woot = Woot Text Int Nat ex2 = match 0 |> Woot "Zonk" +10 with Woot.Woot _ i _ -> i diff --git a/unison-src/tests/fix739.u b/unison-src/tests/fix739.u index 28d36405c..43d914f44 100644 --- a/unison-src/tests/fix739.u +++ b/unison-src/tests/fix739.u @@ -1,4 +1,4 @@ -type MonoidRec a = { +structural type MonoidRec a = { combine : a -> a -> a, empty : a } diff --git a/unison-src/tests/force.u b/unison-src/tests/force.u index b4e1d2bdf..2c33b014d 100644 --- a/unison-src/tests/force.u +++ b/unison-src/tests/force.u @@ -1,4 +1,4 @@ -ability Woot where woot : {Woot} Text +structural ability Woot where woot : {Woot} Text force : '{e} a ->{e} a force a = !a diff --git a/unison-src/tests/guard-boolean-operators.u b/unison-src/tests/guard-boolean-operators.u index a5da96a17..fc04e5468 100644 --- a/unison-src/tests/guard-boolean-operators.u +++ b/unison-src/tests/guard-boolean-operators.u @@ -1,4 +1,4 @@ -type Foo = Foo Boolean Boolean +structural type Foo = Foo Boolean Boolean f : Foo -> Boolean f = cases diff --git a/unison-src/tests/handler-stacking.u b/unison-src/tests/handler-stacking.u index 97d4322ee..46c2d5c45 100644 --- a/unison-src/tests/handler-stacking.u +++ b/unison-src/tests/handler-stacking.u @@ -15,11 +15,11 @@ replicate n x = !x replicate (n `drop` 1) x -ability State a where +structural ability State a where get : {State a} a put : a -> {State a} () -ability Writer w where +structural ability Writer w where tell : w -> {Writer w} () stateHandler : s -> Request {State s} a -> (s, a) diff --git a/unison-src/tests/hang.u b/unison-src/tests/hang.u index 75702f8ef..49cd4210a 100644 --- a/unison-src/tests/hang.u +++ b/unison-src/tests/hang.u @@ -1,10 +1,10 @@ use Universal == < -type Future a = Future ('{Remote} a) +structural type Future a = Future ('{Remote} a) -- A simple distributed computation ability -ability Remote where +structural ability Remote where -- Spawn a new node spawn : {Remote} Node @@ -17,7 +17,7 @@ ability Remote where -- await the result of the computation fork : '{Remote} a ->{Remote} Future a -type Node = Node Nat -- more realistic would be perhaps a (Hostname, PublicKey) pair +structural type Node = Node Nat -- more realistic would be perhaps a (Hostname, PublicKey) pair force : Future a ->{Remote} a force = cases Future.Future r -> !r diff --git a/unison-src/tests/id.u b/unison-src/tests/id.u index 7d0bd3d4d..39b03ed54 100644 --- a/unison-src/tests/id.u +++ b/unison-src/tests/id.u @@ -1,5 +1,4 @@ id : a -> a id x = x -> id - +> id \ No newline at end of file diff --git a/unison-src/tests/if.u b/unison-src/tests/if.u index e3af85295..cc1e77684 100644 --- a/unison-src/tests/if.u +++ b/unison-src/tests/if.u @@ -1,2 +1,2 @@ foo = if true then true else false -> foo +> foo \ No newline at end of file diff --git a/unison-src/tests/io-state2.u b/unison-src/tests/io-state2.u index e5ac00d21..48f825cb8 100644 --- a/unison-src/tests/io-state2.u +++ b/unison-src/tests/io-state2.u @@ -1,5 +1,5 @@ --IO/State2 ability -ability IO where +structural ability IO where launchMissiles : {IO} () foo : Int -> {IO} Int @@ -12,10 +12,10 @@ foo unit = +42 +43 -type Optional a = +structural type Optional a = Some a | None -ability State se2 where +structural ability State se2 where put : ∀ se . se -> {State se} () get : ∀ se . {State se} se diff --git a/unison-src/tests/io-state3.u b/unison-src/tests/io-state3.u index ca05a59cd..9167be8a0 100644 --- a/unison-src/tests/io-state3.u +++ b/unison-src/tests/io-state3.u @@ -1,5 +1,5 @@ --IO3 ability -ability IO where +structural ability IO where launchMissiles : () -> {IO} () -- binding IS guarded, so its body can access whatever abilities -- are declared by the type of the binding diff --git a/unison-src/tests/map-traverse.u b/unison-src/tests/map-traverse.u index 980927ca7..95b884e84 100644 --- a/unison-src/tests/map-traverse.u +++ b/unison-src/tests/map-traverse.u @@ -1,11 +1,11 @@ --map/traverse -ability Noop where +structural ability Noop where noop : ∀ a . a -> {Noop} a -ability Noop2 where +structural ability Noop2 where noop2 : ∀ a . a -> a -> {Noop2} a -type List a = Nil | Cons a (List a) +structural type List a = Nil | Cons a (List a) map : ∀ a b e . (a -> {e} b) -> List a -> {e} (List b) map f = cases diff --git a/unison-src/tests/map-traverse2.u b/unison-src/tests/map-traverse2.u index 61ee14c16..aba52594a 100644 --- a/unison-src/tests/map-traverse2.u +++ b/unison-src/tests/map-traverse2.u @@ -1,11 +1,11 @@ --map/traverse -ability Noop where +structural ability Noop where noop : a -> {Noop} a -ability Noop2 where +structural ability Noop2 where noop2 : a -> a -> {Noop2} a -type List a = Nil | Cons a (List a) +structural type List a = Nil | Cons a (List a) map : (a -> b) -> List a -> List b map f = cases diff --git a/unison-src/tests/methodical/abilities.u b/unison-src/tests/methodical/abilities.u index 339fb2557..0192082bd 100644 --- a/unison-src/tests/methodical/abilities.u +++ b/unison-src/tests/methodical/abilities.u @@ -1,7 +1,7 @@ -- ABILITIES -ability A where +structural ability A where woot : {A} Nat unA = cases @@ -15,7 +15,7 @@ a1 = handle x with unA -ability B where +structural ability B where zing : {B} Int abh = cases @@ -43,7 +43,7 @@ ab2 = with nh with abh -ability C where +structural ability C where n : Nat i : Int diff --git a/unison-src/tests/methodical/apply-constructor.u b/unison-src/tests/methodical/apply-constructor.u index a652f0cba..9b3e98aa1 100644 --- a/unison-src/tests/methodical/apply-constructor.u +++ b/unison-src/tests/methodical/apply-constructor.u @@ -2,7 +2,7 @@ -- Now check exact and underapply cases for constructors -- (overapply of a constructor is always a type error) -type Woot = Woot Nat Nat Nat Nat +structural type Woot = Woot Nat Nat Nat Nat toSeq : Woot -> [Nat] toSeq = cases diff --git a/unison-src/tests/methodical/cycle-minimize.u b/unison-src/tests/methodical/cycle-minimize.u index fc6356e71..837bb58ca 100644 --- a/unison-src/tests/methodical/cycle-minimize.u +++ b/unison-src/tests/methodical/cycle-minimize.u @@ -1,5 +1,5 @@ -ability SpaceAttack where +structural ability SpaceAttack where launchMissiles : Text -> () -- should typecheck fine, as the `launchMissiles "saturn"` diff --git a/unison-src/tests/methodical/overapply-ability.u b/unison-src/tests/methodical/overapply-ability.u index 539871c4f..bb6dfab74 100644 --- a/unison-src/tests/methodical/overapply-ability.u +++ b/unison-src/tests/methodical/overapply-ability.u @@ -2,7 +2,7 @@ -- A corner case in the runtime is when a function is being overapplied and -- the exactly applied function requests an ability (and returns a new function) -ability Zing where +structural ability Zing where zing : Nat -> {Zing} (Nat -> Nat) zing2 : Nat -> Nat ->{Zing} (Nat -> Nat -> [Nat]) diff --git a/unison-src/tests/multiple-effects.u b/unison-src/tests/multiple-effects.u index e01edb87b..12c636a52 100644 --- a/unison-src/tests/multiple-effects.u +++ b/unison-src/tests/multiple-effects.u @@ -1,8 +1,8 @@ -ability State s where +structural ability State s where get : {State s} s set : s -> {State s} () -ability Console where +structural ability Console where read : {Console} (Optional Text) write : Text -> {Console} () diff --git a/unison-src/tests/pattern-matching.u b/unison-src/tests/pattern-matching.u index 866fbb887..b1e2b3c7e 100644 --- a/unison-src/tests/pattern-matching.u +++ b/unison-src/tests/pattern-matching.u @@ -1,8 +1,8 @@ -type Foo0 = Foo0 -type Foo1 a = Foo1 a -type Foo2 a b = Foo2 a b -type Foo3 a b c = Foo3 a b c -type List a = Nil | Cons a (List a) +structural type Foo0 = Foo0 +structural type Foo1 a = Foo1 a +structural type Foo2 a b = Foo2 a b +structural type Foo3 a b c = Foo3 a b c +structural type List a = Nil | Cons a (List a) use Foo0 Foo0 use Foo1 Foo1 diff --git a/unison-src/tests/pattern-matching2.u b/unison-src/tests/pattern-matching2.u index 7bd1bf069..4f6dd8c40 100644 --- a/unison-src/tests/pattern-matching2.u +++ b/unison-src/tests/pattern-matching2.u @@ -1,7 +1,7 @@ -type Foo0 = Foo0 -type Foo1 a = Foo1 a -type Foo2 a b = Foo2 a b -type Foo3 a b c = Foo3 a b c +structural type Foo0 = Foo0 +structural type Foo1 a = Foo1 a +structural type Foo2 a b = Foo2 a b +structural type Foo3 a b c = Foo3 a b c use Foo0 Foo0 use Foo1 Foo1 diff --git a/unison-src/tests/pattern-typing-bug.u b/unison-src/tests/pattern-typing-bug.u index 5ac1d4481..d9bbdf185 100644 --- a/unison-src/tests/pattern-typing-bug.u +++ b/unison-src/tests/pattern-typing-bug.u @@ -1,4 +1,4 @@ -type Value = String Text +structural type Value = String Text | Bool Boolean f : Value -> Nat diff --git a/unison-src/tests/r1.u b/unison-src/tests/r1.u index 855e2d2bf..3bc960ab0 100644 --- a/unison-src/tests/r1.u +++ b/unison-src/tests/r1.u @@ -1,5 +1,5 @@ --r1 -type Optional a = None | Some a +structural type Optional a = None | Some a r1 : Nat r1 = match Optional.Some 3 with x -> 1 diff --git a/unison-src/tests/r2.u b/unison-src/tests/r2.u index a3b925bc1..8218decb7 100644 --- a/unison-src/tests/r2.u +++ b/unison-src/tests/r2.u @@ -1,4 +1,4 @@ -type Optional a = None | Some a +structural type Optional a = None | Some a r2 : Nat r2 = match Optional.Some true with Optional.Some true -> 1 diff --git a/unison-src/tests/rainbow.u b/unison-src/tests/rainbow.u index 378118d1d..30befdb06 100644 --- a/unison-src/tests/rainbow.u +++ b/unison-src/tests/rainbow.u @@ -21,10 +21,10 @@ rainbow x = d = (Ask.ask : Int) +42 -ability Ask a where +structural ability Ask a where ask : {Ask a} a -type Either a b = Left a | Right b +structural type Either a b = Left a | Right b unique ability Zang where zang : {Zang} Nat diff --git a/unison-src/tests/records.u b/unison-src/tests/records.u index 2528896a6..907e18474 100644 --- a/unison-src/tests/records.u +++ b/unison-src/tests/records.u @@ -1,9 +1,9 @@ -type Point x y = { x : x, y : y } +structural type Point x y = { x : x, y : y } -type Point2 = { point2 : Nat, f : Nat } +structural type Point2 = { point2 : Nat, f : Nat } -type Monoid a = { zero : a, plus : a -> a -> a } +structural type Monoid a = { zero : a, plus : a -> a -> a } > Point.x.set 10 (Point 0 0) > Point.x (Point 10 0) diff --git a/unison-src/tests/sequence-literal-argument-parsing.u b/unison-src/tests/sequence-literal-argument-parsing.u index 8005a6756..d6d495bca 100644 --- a/unison-src/tests/sequence-literal-argument-parsing.u +++ b/unison-src/tests/sequence-literal-argument-parsing.u @@ -1,4 +1,4 @@ -type X a = X [a] +structural type X a = X [a] f : X a -> a f = cases diff --git a/unison-src/tests/soe.u b/unison-src/tests/soe.u index dd3b2c62b..0ce0392ee 100644 --- a/unison-src/tests/soe.u +++ b/unison-src/tests/soe.u @@ -1,10 +1,10 @@ use Universal == < -type Future a = Future ('{Remote} a) +structural type Future a = Future ('{Remote} a) -- A simple distributed computation ability -ability Remote where +structural ability Remote where -- Spawn a new node spawn : {Remote} Node @@ -17,7 +17,7 @@ ability Remote where -- await the result of the computation fork : '{Remote} a ->{Remote} Future a -type Node = Node Nat -- more realistic would be perhaps a (Hostname, PublicKey) pair +structural type Node = Node Nat -- more realistic would be perhaps a (Hostname, PublicKey) pair force : Future a ->{Remote} a force = cases Future.Future r -> !r @@ -50,7 +50,7 @@ List.map f as = Some a -> go f (acc `snoc` f a) as (i + 1) go f [] as 0 -type Monoid a = Monoid (a -> a -> a) a +structural type Monoid a = Monoid (a -> a -> a) a Monoid.zero = cases Monoid.Monoid op z -> z Monoid.op = cases Monoid.Monoid op z -> op diff --git a/unison-src/tests/spurious-ability-fail-underapply.u b/unison-src/tests/spurious-ability-fail-underapply.u index 64cec3c05..1d1453028 100644 --- a/unison-src/tests/spurious-ability-fail-underapply.u +++ b/unison-src/tests/spurious-ability-fail-underapply.u @@ -1,4 +1,4 @@ -ability Woot where +structural ability Woot where woot : {Woot} Nat wha : ((a ->{Woot} a) -> a ->{Woot} a) -> Nat diff --git a/unison-src/tests/state1.u b/unison-src/tests/state1.u index 61b0e2cb9..4a529b303 100644 --- a/unison-src/tests/state1.u +++ b/unison-src/tests/state1.u @@ -1,5 +1,5 @@ --State1 ability -ability State se2 where +structural ability State se2 where put : ∀ se . se -> {State se} () get : ∀ se . () -> {State se} se diff --git a/unison-src/tests/state1a.u b/unison-src/tests/state1a.u index 471170b86..ed588573c 100644 --- a/unison-src/tests/state1a.u +++ b/unison-src/tests/state1a.u @@ -1,5 +1,5 @@ --State1a ability -ability State se2 where +structural ability State se2 where put : ∀ se . se -> {State se} () get : ∀ se . {State se} se id : Int -> Int diff --git a/unison-src/tests/state2.u b/unison-src/tests/state2.u index 62337b107..acf525f9b 100644 --- a/unison-src/tests/state2.u +++ b/unison-src/tests/state2.u @@ -1,5 +1,5 @@ --State2 ability -ability State se2 where +structural ability State se2 where put : ∀ se . se -> {State se} () get : ∀ se . () -> {State se} se state : ∀ s a . s -> Request (State s) a -> (s, a) diff --git a/unison-src/tests/state2a-min.u b/unison-src/tests/state2a-min.u index 63a632a70..c62a8c08c 100644 --- a/unison-src/tests/state2a-min.u +++ b/unison-src/tests/state2a-min.u @@ -1,5 +1,5 @@ --State2 ability -ability State s where +structural ability State s where put : s -> {State s} () state : s -> Request (State s) a -> a diff --git a/unison-src/tests/state2a.u b/unison-src/tests/state2a.u index c2dcc58a0..cd98bbad2 100644 --- a/unison-src/tests/state2a.u +++ b/unison-src/tests/state2a.u @@ -1,8 +1,8 @@ --State2 ability -type Optional a = None | Some a +structural type Optional a = None | Some a -ability State s where +structural ability State s where put : s -> {State s} () get : {State s} s diff --git a/unison-src/tests/state2a.uu b/unison-src/tests/state2a.uu index 82a2306eb..8b0dc5587 100644 --- a/unison-src/tests/state2a.uu +++ b/unison-src/tests/state2a.uu @@ -1,8 +1,8 @@ --State2 ability -type Optional a = None | Some a +structural type Optional a = None | Some a -ability State s where +structural ability State s where put : s -> {State s} () get : {State s} s diff --git a/unison-src/tests/state2b-min.u b/unison-src/tests/state2b-min.u index 257ca9e3e..44c971cb8 100644 --- a/unison-src/tests/state2b-min.u +++ b/unison-src/tests/state2b-min.u @@ -1,5 +1,5 @@ --State2 ability -ability State s where +structural ability State s where put : s -> {State s} () state : s -> Request (State s) a -> s diff --git a/unison-src/tests/state2b.u b/unison-src/tests/state2b.u index b036ed028..561ce7109 100644 --- a/unison-src/tests/state2b.u +++ b/unison-src/tests/state2b.u @@ -1,8 +1,8 @@ --State2 ability -type Optional a = None | Some a +structural type Optional a = None | Some a -ability State s where +structural ability State s where put : s -> {State s} () get : {State s} s diff --git a/unison-src/tests/state3.u b/unison-src/tests/state3.u index cc1501681..bebb7d163 100644 --- a/unison-src/tests/state3.u +++ b/unison-src/tests/state3.u @@ -1,5 +1,5 @@ --State3 ability -ability State se2 where +structural ability State se2 where put : ∀ se . se -> {State se} () get : ∀ se . () -> {State se} se diff --git a/unison-src/tests/state4.u b/unison-src/tests/state4.u index 3db4bd9c4..3ed0e7aba 100644 --- a/unison-src/tests/state4.u +++ b/unison-src/tests/state4.u @@ -1,4 +1,4 @@ -ability State s where +structural ability State s where put : s -> {State s} () get : {State s} s diff --git a/unison-src/tests/state4a.u b/unison-src/tests/state4a.u index 04544e945..8455432d4 100644 --- a/unison-src/tests/state4a.u +++ b/unison-src/tests/state4a.u @@ -1,4 +1,4 @@ -ability State s where +structural ability State s where put : s -> {State s} () get : {State s} s diff --git a/unison-src/tests/stream.u b/unison-src/tests/stream.u index f790e97df..bd170a704 100644 --- a/unison-src/tests/stream.u +++ b/unison-src/tests/stream.u @@ -1,7 +1,7 @@ -ability Emit a where +structural ability Emit a where emit : a ->{Emit a} () -type Stream e a r = Stream ('{e, Emit a} r) +structural type Stream e a r = Stream ('{e, Emit a} r) use Stream Stream use Optional None Some diff --git a/unison-src/tests/stream2.uu b/unison-src/tests/stream2.uu index fd2862d47..8daa0111d 100644 --- a/unison-src/tests/stream2.uu +++ b/unison-src/tests/stream2.uu @@ -1,7 +1,7 @@ -ability Emit a where +structural ability Emit a where emit : a ->{Emit a} () -type Stream e a r = Stream ('{e, Emit a} r) +structural type Stream e a r = Stream ('{e, Emit a} r) use Stream Stream use Optional None Some diff --git a/unison-src/tests/stream3.uu b/unison-src/tests/stream3.uu index 3e6a2d5e8..cbb3d1c6e 100644 --- a/unison-src/tests/stream3.uu +++ b/unison-src/tests/stream3.uu @@ -1,7 +1,7 @@ -ability Emit a where +structural ability Emit a where emit : a ->{Emit a} () -type Stream e a r = Stream ('{e, Emit a} r) +structural type Stream e a r = Stream ('{e, Emit a} r) use Stream Stream use Optional None Some @@ -50,7 +50,7 @@ namespace Stream where run : Stream e a r ->{e, Emit a} r run = cases Stream c -> !c -ability Abort where +structural ability Abort where abort : {Abort} a --- diff --git a/unison-src/tests/tictactoe.u b/unison-src/tests/tictactoe.u index e3dde4d4b..390b69f33 100644 --- a/unison-src/tests/tictactoe.u +++ b/unison-src/tests/tictactoe.u @@ -1,7 +1,7 @@ -- board piece -type P = X | O | E +structural type P = X | O | E -type Board = Board P P P P P P P P P +structural type Board = Board P P P P P P P P P use Board Board use P O X E diff --git a/unison-src/tests/tictactoe0-array-oob1.u b/unison-src/tests/tictactoe0-array-oob1.u index 22989cd6e..cbabf6b46 100644 --- a/unison-src/tests/tictactoe0-array-oob1.u +++ b/unison-src/tests/tictactoe0-array-oob1.u @@ -1,6 +1,6 @@ -- board piece -type Board = Board Nat Nat Nat +structural type Board = Board Nat Nat Nat use Board Board diff --git a/unison-src/tests/tictactoe0-npe.u b/unison-src/tests/tictactoe0-npe.u index d1845df89..9edc4c58d 100644 --- a/unison-src/tests/tictactoe0-npe.u +++ b/unison-src/tests/tictactoe0-npe.u @@ -1,7 +1,7 @@ -- board piece -type P = X | O | E +structural type P = X | O | E -type Board = Board P P P P P P P P P +structural type Board = Board P P P P P P P P P use Board Board use P O X E diff --git a/unison-src/tests/tictactoe0.u b/unison-src/tests/tictactoe0.u index a6e0ff7a5..d0628f720 100644 --- a/unison-src/tests/tictactoe0.u +++ b/unison-src/tests/tictactoe0.u @@ -1,7 +1,7 @@ -- board piece -type P = X | O | E +structural type P = X | O | E -type Board = Board P P P P P P P P P +structural type Board = Board P P P P P P P P P use Board Board use P O X E diff --git a/unison-src/tests/tictactoe2.u b/unison-src/tests/tictactoe2.u index cf02bcc44..9ebaf3b30 100644 --- a/unison-src/tests/tictactoe2.u +++ b/unison-src/tests/tictactoe2.u @@ -1,7 +1,7 @@ -- board piece -type P = X | O | E +structural type P = X | O | E -type Board = Board P P P P P P P P P +structural type Board = Board P P P P P P P P P use Board Board use P O X E diff --git a/unison-src/tests/type-application.u b/unison-src/tests/type-application.u index ae54823ad..87b673809 100644 --- a/unison-src/tests/type-application.u +++ b/unison-src/tests/type-application.u @@ -1,8 +1,8 @@ -ability Foo where +structural ability Foo where foo : {Foo} Nat -type Wrap a = Wrap Nat +structural type Wrap a = Wrap Nat blah : Wrap {Foo} -> Nat blah = cases diff --git a/unison-src/tests/ungeneralize-bug.uu b/unison-src/tests/ungeneralize-bug.uu index 5a5448ed1..f3fc3403c 100644 --- a/unison-src/tests/ungeneralize-bug.uu +++ b/unison-src/tests/ungeneralize-bug.uu @@ -2,7 +2,7 @@ use Foo Foo use Optional Some None -type Foo a b = Foo a (Optional b) +structural type Foo a b = Foo a (Optional b) foo : Foo a b -> (b -> c) -> Foo a c foo x f = match x with diff --git a/unison-src/tests/void.u b/unison-src/tests/void.u index a4e646ad3..701265f62 100644 --- a/unison-src/tests/void.u +++ b/unison-src/tests/void.u @@ -1,3 +1,3 @@ -type Void = +structural type Void = > 3 diff --git a/unison-src/transcripts-using-base/base.u b/unison-src/transcripts-using-base/base.u index 1d49c6dd8..0b32ce505 100644 --- a/unison-src/transcripts-using-base/base.u +++ b/unison-src/transcripts-using-base/base.u @@ -7,7 +7,7 @@ compose3 f g = a -> b -> c -> f (g a b c) id a = a -ability Exception where +structural ability Exception where raise: io2.Failure -> anything Exception.reraise : Either Failure a ->{Exception} a @@ -23,7 +23,7 @@ Exception.toEither.handler = cases Exception.toEither : '{ε, Exception} a -> {ε} Either Failure a Exception.toEither a = handle !a with Exception.toEither.handler -ability Throw e where +structural ability Throw e where throw : e -> a List.all : (a ->{ε} Boolean) -> [a] ->{ε} Boolean @@ -66,7 +66,7 @@ isNone = cases None -> true -ability Stream a where +structural ability Stream a where emit: a -> () Stream.toList.handler : Request {Stream a} r -> [a] @@ -97,7 +97,7 @@ Stream.collect s = -- An ability that facilitates creating temoporary directories that can be -- automatically cleaned up -ability TempDirs where +structural ability TempDirs where newTempDir: Text -> Text removeDir: Text -> () diff --git a/unison-src/transcripts-using-base/codeops.md b/unison-src/transcripts-using-base/codeops.md index 7933a428c..94db31d19 100644 --- a/unison-src/transcripts-using-base/codeops.md +++ b/unison-src/transcripts-using-base/codeops.md @@ -36,7 +36,7 @@ identical err x y = then () else throw ("mismatch" ++ err) -type Three a b c = zero a | one b | two c +structural type Three a b c = zero a | one b | two c showThree : Three Nat Nat Nat -> Text showThree = cases @@ -89,7 +89,7 @@ identicality t x ``` ```unison -ability Zap where +structural ability Zap where zap : Three Nat Nat Nat h : Three Nat Nat Nat -> Nat -> Nat diff --git a/unison-src/transcripts-using-base/codeops.output.md b/unison-src/transcripts-using-base/codeops.output.md index a2b7856d5..eb8d902d4 100644 --- a/unison-src/transcripts-using-base/codeops.output.md +++ b/unison-src/transcripts-using-base/codeops.output.md @@ -31,7 +31,7 @@ identical err x y = then () else throw ("mismatch" ++ err) -type Three a b c = zero a | one b | two c +structural type Three a b c = zero a | one b | two c showThree : Three Nat Nat Nat -> Text showThree = cases @@ -87,7 +87,7 @@ identicality t x ⍟ These new definitions are ok to `add`: - type Three a b c + structural type Three a b c concatMap : (a ->{g} [b]) -> [a] ->{g} [b] extensionality : Text -> (Three Nat Nat Nat -> Nat -> b) @@ -114,7 +114,7 @@ identicality t x ⍟ I've added these definitions: - type Three a b c + structural type Three a b c concatMap : (a ->{g} [b]) -> [a] ->{g} [b] extensionality : Text -> (Three Nat Nat Nat -> Nat -> b) @@ -137,7 +137,7 @@ identicality t x ``` ```unison -ability Zap where +structural ability Zap where zap : Three Nat Nat Nat h : Three Nat Nat Nat -> Nat -> Nat @@ -212,7 +212,7 @@ badLoad _ = ⍟ These new definitions are ok to `add`: - ability Zap + structural ability Zap badLoad : '{IO} [Result] f : Nat ->{Zap} Nat fDeps : [Link.Term] @@ -233,7 +233,7 @@ to actual show that the serialization works. ⍟ I've added these definitions: - ability Zap + structural ability Zap badLoad : '{IO} [Result] f : Nat ->{Zap} Nat fDeps : [Link.Term] diff --git a/unison-src/transcripts-using-base/doc.output.md b/unison-src/transcripts-using-base/doc.output.md index 38321c889..badb23bba 100644 --- a/unison-src/transcripts-using-base/doc.output.md +++ b/unison-src/transcripts-using-base/doc.output.md @@ -335,7 +335,7 @@ and the rendered output using `display`: Unison definitions can be included in docs. For instance: - type Optional a = None | Some a + structural type Optional a = None | Some a sqr x = use Nat * @@ -343,7 +343,7 @@ and the rendered output using `display`: Some rendering targets also support folded source: - type Optional a = None | Some a + structural type Optional a = None | Some a sqr x = use Nat * @@ -637,7 +637,7 @@ Lastly, it's common to build longer documents including subdocuments via `{{ sub Unison definitions can be included in docs. For instance: - type Optional a = None | Some a + structural type Optional a = None | Some a sqr x = use Nat * @@ -645,7 +645,7 @@ Lastly, it's common to build longer documents including subdocuments via `{{ sub Some rendering targets also support folded source: - type Optional a = None | Some a + structural type Optional a = None | Some a sqr x = use Nat * diff --git a/unison-src/transcripts-using-base/fix2027.md b/unison-src/transcripts-using-base/fix2027.md index fc0fc9f7b..23e9498ca 100644 --- a/unison-src/transcripts-using-base/fix2027.md +++ b/unison-src/transcripts-using-base/fix2027.md @@ -5,13 +5,13 @@ ``` ```unison -ability Exception where raise : Failure -> x +structural ability Exception where raise : Failure -> x reraise = cases Left e -> raise e Right a -> a -type Either a b = Left a | Right b +structural type Either a b = Left a | Right b putBytes h bs = reraise (putBytes.impl h bs) diff --git a/unison-src/transcripts-using-base/fix2027.output.md b/unison-src/transcripts-using-base/fix2027.output.md index 59e378333..de62d3c43 100644 --- a/unison-src/transcripts-using-base/fix2027.output.md +++ b/unison-src/transcripts-using-base/fix2027.output.md @@ -1,13 +1,13 @@ ```unison -ability Exception where raise : Failure -> x +structural ability Exception where raise : Failure -> x reraise = cases Left e -> raise e Right a -> a -type Either a b = Left a | Right b +structural type Either a b = Left a | Right b putBytes h bs = reraise (putBytes.impl h bs) @@ -52,34 +52,29 @@ myServer = unsafeRun! '(hello "127.0.0.1" "0") do an `add` or `update`, here's how your codebase would change: - ⊡ Previously added definitions will be ignored: Exception - Exception.raise - ⍟ These new definitions are ok to `add`: - type Either a b + structural type Either a b (also named builtin.Either) + structural ability Exception + (also named builtin.Exception) Exception.unsafeRun! : '{g, Exception} a -> '{g} a bugFail : Failure -> r + closeSocket : Socket ->{IO, Exception} () hello : Text -> Text ->{IO, Exception} () myServer : '{IO} () + putBytes : Handle + -> Bytes + ->{IO, Exception} () putText : Handle -> Text ->{IO, Exception} () reraise : Either Failure b ->{Exception} b - (also named Exception.reraise) + serverSocket : Optional Text + -> Text + ->{IO, Exception} Socket socketSend : Socket -> Bytes ->{IO, Exception} () toException : Either Failure a ->{Exception} a - (also named Exception.reraise) - - ⍟ These names already exist. You can `update` them to your - new definition: - - closeSocket : Socket ->{IO, Exception} () - putBytes : Handle -> Bytes ->{IO, Exception} () - serverSocket : Optional Text - -> Text - ->{IO, Exception} Socket ``` ```ucm diff --git a/unison-src/transcripts-using-base/fix2158-1.md b/unison-src/transcripts-using-base/fix2158-1.md index c80faa3f1..16721569e 100644 --- a/unison-src/transcripts-using-base/fix2158-1.md +++ b/unison-src/transcripts-using-base/fix2158-1.md @@ -1,7 +1,7 @@ This transcript tests an ability check failure regression. ```unison -ability Async t g where +structural ability Async t g where fork : '{Async t g, g} a -> t a await : t a -> a diff --git a/unison-src/transcripts-using-base/fix2158-1.output.md b/unison-src/transcripts-using-base/fix2158-1.output.md index f9419e4a4..645cfe801 100644 --- a/unison-src/transcripts-using-base/fix2158-1.output.md +++ b/unison-src/transcripts-using-base/fix2158-1.output.md @@ -1,7 +1,7 @@ This transcript tests an ability check failure regression. ```unison -ability Async t g where +structural ability Async t g where fork : '{Async t g, g} a -> t a await : t a -> a @@ -19,7 +19,7 @@ Async.parMap f as = ⍟ These new definitions are ok to `add`: - ability Async t g + structural ability Async t g Async.parMap : (a ->{g, Async t g} b) -> [a] ->{Async t g} [b] diff --git a/unison-src/transcripts-using-base/fix2297.output.md b/unison-src/transcripts-using-base/fix2297.output.md index a2a8f85a8..fb2aa368d 100644 --- a/unison-src/transcripts-using-base/fix2297.output.md +++ b/unison-src/transcripts-using-base/fix2297.output.md @@ -27,9 +27,13 @@ wat = handleTrivial testAction -- Somehow this completely forgets about Excepti ```ucm - The expression in red needs the {Exception} ability, but this location does not have access to any abilities. + I expected to see `structural` or `unique` at the start of + this line: - 19 | wat = handleTrivial testAction -- Somehow this completely forgets about Exception and IO + 1 | ability Trivial where + Learn more about when to use `structural` vs `unique` in the + Unison Docs: + https://www.unisonweb.org/docs/language-reference/#unique-types ``` diff --git a/unison-src/transcripts/addupdatemessages.output.md b/unison-src/transcripts/addupdatemessages.output.md index 6dc3cfb67..ce3488b20 100644 --- a/unison-src/transcripts/addupdatemessages.output.md +++ b/unison-src/transcripts/addupdatemessages.output.md @@ -6,8 +6,8 @@ Let's set up some definitions to start: x = 1 y = 2 -structural type X = One Nat -structural type Y = Two Nat Nat +structural type X = One Nat +structural type Y = Two Nat Nat ``` ```ucm @@ -44,7 +44,7 @@ Let's add an alias for `1` and `One`: ```unison z = 1 -structural type Z = One Nat +structural type Z = One Nat ``` ```ucm @@ -79,7 +79,7 @@ Let's update something that has an alias (to a value that doesn't have a name al ```unison x = 3 -structural type X = Three Nat Nat Nat +structural type X = Three Nat Nat Nat ``` ```ucm @@ -118,7 +118,7 @@ Update it to something that already exists with a different name: ```unison x = 2 -structural type X = Two Nat Nat +structural type X = Two Nat Nat ``` ```ucm diff --git a/unison-src/transcripts/blocks.md b/unison-src/transcripts/blocks.md index c7f427709..f76739101 100644 --- a/unison-src/transcripts/blocks.md +++ b/unison-src/transcripts/blocks.md @@ -125,7 +125,7 @@ Just don't try to run it as it's an infinite loop! The reason is it's unclear what the order should be of any requests that are made. It can also be viewed of a special case of the restriction that elements of a cycle must all be guarded. Here's an example: ```unison:error -ability SpaceAttack where +structural ability SpaceAttack where launchMissiles : Text -> Nat ex n = @@ -139,7 +139,7 @@ ex n = For instance, this works fine: ```unison -ability SpaceAttack where +structural ability SpaceAttack where launchMissiles : Text -> Nat ex n = @@ -153,7 +153,7 @@ ex n = For instance, `zap` here isn't considered part of the cycle (it doesn't reference `ping` or `pong`), so this typechecks fine: ```unison -ability SpaceAttack where +structural ability SpaceAttack where launchMissiles : Text -> Nat ex n = @@ -166,7 +166,7 @@ ex n = This is actually parsed as if you moved `zap` after the cycle it find itself a part of: ```unison -ability SpaceAttack where +structural ability SpaceAttack where launchMissiles : Text -> Nat ex n = diff --git a/unison-src/transcripts/blocks.output.md b/unison-src/transcripts/blocks.output.md index 3c8247250..28628efed 100644 --- a/unison-src/transcripts/blocks.output.md +++ b/unison-src/transcripts/blocks.output.md @@ -242,7 +242,7 @@ Just don't try to run it as it's an infinite loop! The reason is it's unclear what the order should be of any requests that are made. It can also be viewed of a special case of the restriction that elements of a cycle must all be guarded. Here's an example: ```unison -ability SpaceAttack where +structural ability SpaceAttack where launchMissiles : Text -> Nat ex n = @@ -264,7 +264,7 @@ ex n = For instance, this works fine: ```unison -ability SpaceAttack where +structural ability SpaceAttack where launchMissiles : Text -> Nat ex n = @@ -281,7 +281,7 @@ ex n = ⍟ These new definitions are ok to `add`: - ability SpaceAttack + structural ability SpaceAttack ex : n ->{SpaceAttack} Nat ``` @@ -290,7 +290,7 @@ ex n = For instance, `zap` here isn't considered part of the cycle (it doesn't reference `ping` or `pong`), so this typechecks fine: ```unison -ability SpaceAttack where +structural ability SpaceAttack where launchMissiles : Text -> Nat ex n = @@ -308,14 +308,14 @@ ex n = ⍟ These new definitions are ok to `add`: - ability SpaceAttack + structural ability SpaceAttack ex : n ->{SpaceAttack} r ``` This is actually parsed as if you moved `zap` after the cycle it find itself a part of: ```unison -ability SpaceAttack where +structural ability SpaceAttack where launchMissiles : Text -> Nat ex n = @@ -333,7 +333,7 @@ ex n = ⍟ These new definitions are ok to `add`: - ability SpaceAttack + structural ability SpaceAttack ex : n ->{SpaceAttack} r ``` diff --git a/unison-src/transcripts/bug-strange-closure.output.md b/unison-src/transcripts/bug-strange-closure.output.md index b6ec78773..8d2aacaab 100644 --- a/unison-src/transcripts/bug-strange-closure.output.md +++ b/unison-src/transcripts/bug-strange-closure.output.md @@ -88,7 +88,7 @@ We can display the guide before and after adding it to the codebase: Unison definitions can be included in docs. For instance: - type Optional a = None | Some a + structural type Optional a = None | Some a sqr x = use Nat * @@ -96,7 +96,7 @@ We can display the guide before and after adding it to the codebase: Some rendering targets also support folded source: - type Optional a = None | Some a + structural type Optional a = None | Some a sqr x = use Nat * @@ -289,7 +289,7 @@ We can display the guide before and after adding it to the codebase: Unison definitions can be included in docs. For instance: - type Optional a = None | Some a + structural type Optional a = None | Some a sqr x = use Nat * @@ -297,7 +297,7 @@ We can display the guide before and after adding it to the codebase: Some rendering targets also support folded source: - type Optional a = None | Some a + structural type Optional a = None | Some a sqr x = use Nat * @@ -496,7 +496,7 @@ rendered = Pretty.get (docFormatConsole doc.guide) Unison definitions can be included in docs. For instance: - type Optional a = None | Some a + structural type Optional a = None | Some a sqr x = use Nat * @@ -504,7 +504,7 @@ rendered = Pretty.get (docFormatConsole doc.guide) Some rendering targets also support folded source: - type Optional a = None | Some a + structural type Optional a = None | Some a sqr x = use Nat * @@ -690,7 +690,7 @@ rendered = Pretty.get (docFormatConsole doc.guide) Unison definitions can be included in docs. For instance: - type Optional a = None | Some a + structural type Optional a = None | Some a sqr x = use Nat * @@ -698,7 +698,7 @@ rendered = Pretty.get (docFormatConsole doc.guide) Some rendering targets also support folded source: - type Optional a = None | Some a + structural type Optional a = None | Some a sqr x = use Nat * diff --git a/unison-src/transcripts/command-replace.output.md b/unison-src/transcripts/command-replace.output.md index 8957f570e..84f905e1e 100644 --- a/unison-src/transcripts/command-replace.output.md +++ b/unison-src/transcripts/command-replace.output.md @@ -6,8 +6,8 @@ Let's set up some definitions to start: x = 1 y = 2 -type X = One Nat -type Y = Two Nat Nat +structural type X = One Nat +structural type Y = Two Nat Nat ``` ```ucm @@ -18,8 +18,8 @@ type Y = Two Nat Nat ⍟ These new definitions are ok to `add`: - type X - type Y + structural type X + structural type Y x : Nat y : Nat @@ -31,8 +31,8 @@ type Y = Two Nat Nat ⍟ I've added these definitions: - type X - type Y + structural type X + structural type Y x : Nat y : Nat @@ -57,10 +57,10 @@ Test that replace works with types .scratch> find - 1. type X + 1. structural type X 2. x : Nat 3. X.One : Nat -> Nat -> X - 4. type Y + 4. structural type Y 5. y : Nat 6. Y.Two : Nat -> Nat -> X @@ -77,7 +77,7 @@ Test that replace works with types .scratch> view X - type X = One Nat Nat + structural type X = One Nat Nat ``` Try with a type/term mismatch diff --git a/unison-src/transcripts/diff.md b/unison-src/transcripts/diff.md index 5846af90c..1f31db2a8 100644 --- a/unison-src/transcripts/diff.md +++ b/unison-src/transcripts/diff.md @@ -40,8 +40,8 @@ bdependent = b c = 3 helloWorld = "Hello, world!" -type A a = A Nat -ability X a1 a2 where x : Nat +structural type A a = A Nat +structural ability X a1 a2 where x : Nat ``` ```ucm diff --git a/unison-src/transcripts/diff.output.md b/unison-src/transcripts/diff.output.md index cda20f1fc..9cec95d7f 100644 --- a/unison-src/transcripts/diff.output.md +++ b/unison-src/transcripts/diff.output.md @@ -105,8 +105,8 @@ bdependent = b c = 3 helloWorld = "Hello, world!" -type A a = A Nat -ability X a1 a2 where x : Nat +structural type A a = A Nat +structural ability X a1 a2 where x : Nat ``` ```ucm @@ -116,8 +116,8 @@ ability X a1 a2 where x : Nat ⍟ I've added these definitions: - type A a - ability X a1 a2 + structural type A a + structural ability X a1 a2 b : Nat bdependent : Nat c : Nat @@ -155,8 +155,8 @@ Here's what we've done so far: Added definitions: - 1. type A a - 2. ability X a1 a2 + 1. structural type A a + 2. structural ability X a1 a2 3. A.A : Nat -> A a 4. X.x : {X a1 a2} Nat 5. b : Nat diff --git a/unison-src/transcripts/docs.output.md b/unison-src/transcripts/docs.output.md index f4d9d2adb..a78489a95 100644 --- a/unison-src/transcripts/docs.output.md +++ b/unison-src/transcripts/docs.output.md @@ -14,7 +14,7 @@ Unison documentation is written in Unison. Documentation is a value of the follo | Evaluate Term ``` -You can create these `Doc` values with ordinary code, or you can use the special syntax. A value of type `Doc` can be created via syntax like: +You can create these `Doc` values with ordinary code, or you can use the special syntax. A value of structural type `Doc` can be created via syntax like: ```unison use .builtin diff --git a/unison-src/transcripts/fix1731.md b/unison-src/transcripts/fix1731.md index 29fd0d5f0..81adcd8de 100644 --- a/unison-src/transcripts/fix1731.md +++ b/unison-src/transcripts/fix1731.md @@ -4,7 +4,7 @@ ``` ```unison:hide -ability CLI where +structural ability CLI where print : Text ->{CLI} () input : {CLI} Text ``` diff --git a/unison-src/transcripts/fix1731.output.md b/unison-src/transcripts/fix1731.output.md index 48fe35db6..3ed9b26b3 100644 --- a/unison-src/transcripts/fix1731.output.md +++ b/unison-src/transcripts/fix1731.output.md @@ -1,6 +1,6 @@ ```unison -ability CLI where +structural ability CLI where print : Text ->{CLI} () input : {CLI} Text ``` diff --git a/unison-src/transcripts/fix2026.md b/unison-src/transcripts/fix2026.md index 56ddc8167..819a579e2 100644 --- a/unison-src/transcripts/fix2026.md +++ b/unison-src/transcripts/fix2026.md @@ -3,7 +3,7 @@ ``` ```unison -ability Exception where raise : Failure -> x +structural ability Exception where raise : Failure -> x ex = unsafeRun! '(printLine "hello world") diff --git a/unison-src/transcripts/fix2026.output.md b/unison-src/transcripts/fix2026.output.md index e28df2509..b8b91f095 100644 --- a/unison-src/transcripts/fix2026.output.md +++ b/unison-src/transcripts/fix2026.output.md @@ -1,5 +1,5 @@ ```unison -ability Exception where raise : Failure -> x +structural ability Exception where raise : Failure -> x ex = unsafeRun! '(printLine "hello world") @@ -43,7 +43,7 @@ Exception.unsafeRun! e _ = ⍟ These new definitions are ok to `add`: - ability Exception + structural ability Exception (also named builtin.Exception) Exception.unsafeRun! : '{g, Exception} a -> '{g} a compose2 : (c ->{𝕖1} d) diff --git a/unison-src/transcripts/fix2167.md b/unison-src/transcripts/fix2167.md index cb5a64f30..4e65ddb6f 100644 --- a/unison-src/transcripts/fix2167.md +++ b/unison-src/transcripts/fix2167.md @@ -6,7 +6,7 @@ This is just a simple transcript to regression check an ability inference/checking issue. ```unison -ability R t where +structural ability R t where die : () -> x near.impl : Nat -> Either () [Nat] diff --git a/unison-src/transcripts/fix2167.output.md b/unison-src/transcripts/fix2167.output.md index 4a6f3de65..28826bdcf 100644 --- a/unison-src/transcripts/fix2167.output.md +++ b/unison-src/transcripts/fix2167.output.md @@ -2,7 +2,7 @@ This is just a simple transcript to regression check an ability inference/checking issue. ```unison -ability R t where +structural ability R t where die : () -> x near.impl : Nat -> Either () [Nat] @@ -23,7 +23,7 @@ R.near1 region loc = match R.near 42 with ⍟ These new definitions are ok to `add`: - ability R t + structural ability R t R.near : Nat ->{R t} [Nat] R.near1 : region -> loc ->{R t} Nat diff --git a/unison-src/transcripts/fix2238.md b/unison-src/transcripts/fix2238.md index eaacb39b4..356209639 100644 --- a/unison-src/transcripts/fix2238.md +++ b/unison-src/transcripts/fix2238.md @@ -6,7 +6,7 @@ This should not typecheck - the inline `@eval` expression uses abilities. ```unison:error -ability Abort where abort : x +structural ability Abort where abort : x ex = {{ @eval{abort} }} ``` diff --git a/unison-src/transcripts/fix2238.output.md b/unison-src/transcripts/fix2238.output.md index 595118463..a54cdd81b 100644 --- a/unison-src/transcripts/fix2238.output.md +++ b/unison-src/transcripts/fix2238.output.md @@ -2,7 +2,7 @@ This should not typecheck - the inline `@eval` expression uses abilities. ```unison -ability Abort where abort : x +structural ability Abort where abort : x ex = {{ @eval{abort} }} ``` diff --git a/unison-src/transcripts/fix2238.u b/unison-src/transcripts/fix2238.u index 01fcf7cc3..19e81357e 100644 --- a/unison-src/transcripts/fix2238.u +++ b/unison-src/transcripts/fix2238.u @@ -1,5 +1,5 @@ -ability Abort where abort : x +structural ability Abort where abort : x ex = {{ diff --git a/unison-src/transcripts/fix2254.output.md b/unison-src/transcripts/fix2254.output.md index 3f53636f6..21b13d2d9 100644 --- a/unison-src/transcripts/fix2254.output.md +++ b/unison-src/transcripts/fix2254.output.md @@ -8,7 +8,7 @@ unique type A a b c d | C c | D d -type NeedsA a b = NeedsA (A a b Nat Nat) +structural type NeedsA a b = NeedsA (A a b Nat Nat) | Zoink Text f : A Nat Nat Nat Nat -> Nat @@ -41,7 +41,7 @@ We'll make our edits in a fork of the `a` namespace: ⍟ I've added these definitions: unique type A a b c d - type NeedsA a b + structural type NeedsA a b f : A Nat Nat Nat Nat -> Nat f2 : A Nat Nat Nat Nat -> Nat f3 : NeedsA Nat Nat -> Nat @@ -74,9 +74,16 @@ Let's do the update now, and verify that the definitions all look good and there .a2> view A NeedsA f f2 f3 g - unique type A a b c d = E a d | C c | A a | B b | D d + unique type A a b c d + = E a d + | C c + | A a + | B b + | D d - type NeedsA a b = Zoink Text | NeedsA (A a b Nat Nat) + structural type NeedsA a b + = Zoink Text + | NeedsA (A a b Nat Nat) f : A Nat Nat Nat Nat -> Nat f = cases @@ -113,7 +120,7 @@ Let's do the update now, and verify that the definitions all look good and there Here's a test of updating a record: ```unison -type Rec = { uno : Nat, dos : Nat } +structural type Rec = { uno : Nat, dos : Nat } combine r = uno r + dos r ``` @@ -126,7 +133,7 @@ combine r = uno r + dos r ⍟ These new definitions are ok to `add`: - type Rec + structural type Rec Rec.dos : Rec -> Nat Rec.dos.modify : (Nat ->{g} Nat) -> Rec ->{g} Rec Rec.dos.set : Nat -> Rec -> Rec @@ -143,7 +150,7 @@ combine r = uno r + dos r ⍟ I've added these definitions: - type Rec + structural type Rec Rec.dos : Rec -> Nat Rec.dos.modify : (Nat ->{g} Nat) -> Rec ->{g} Rec Rec.dos.set : Nat -> Rec -> Rec @@ -154,7 +161,7 @@ combine r = uno r + dos r ``` ```unison -type Rec = { uno : Nat, dos : Nat, tres : Text } +structural type Rec = { uno : Nat, dos : Nat, tres : Text } ``` ```ucm @@ -172,7 +179,7 @@ type Rec = { uno : Nat, dos : Nat, tres : Text } ⍟ These names already exist. You can `update` them to your new definition: - type Rec + structural type Rec Rec.dos : Rec -> Nat Rec.dos.modify : (Nat ->{g} Nat) -> Rec ->{g} Rec Rec.dos.set : Nat -> Rec -> Rec @@ -198,7 +205,7 @@ And checking that after updating this record, there's nothing `todo`: ⍟ I've updated these names to your new definition: - type Rec + structural type Rec Rec.dos : Rec -> Nat Rec.dos.modify : (Nat ->{g} Nat) -> Rec ->{g} Rec Rec.dos.set : Nat -> Rec -> Rec diff --git a/unison-src/transcripts/fix689.md b/unison-src/transcripts/fix689.md index a156daa6a..b22106eed 100644 --- a/unison-src/transcripts/fix689.md +++ b/unison-src/transcripts/fix689.md @@ -5,7 +5,7 @@ Tests the fix for https://github.com/unisonweb/unison/issues/689 ``` ``` unison -ability SystemTime where +structural ability SystemTime where systemTime : ##Nat tomorrow = '(SystemTime.systemTime + 24 * 60 * 60) diff --git a/unison-src/transcripts/fix689.output.md b/unison-src/transcripts/fix689.output.md index e4d39e5bc..6f8b8db76 100644 --- a/unison-src/transcripts/fix689.output.md +++ b/unison-src/transcripts/fix689.output.md @@ -1,7 +1,7 @@ Tests the fix for https://github.com/unisonweb/unison/issues/689 ```unison -ability SystemTime where +structural ability SystemTime where systemTime : ##Nat tomorrow = '(SystemTime.systemTime + 24 * 60 * 60) @@ -15,7 +15,7 @@ tomorrow = '(SystemTime.systemTime + 24 * 60 * 60) ⍟ These new definitions are ok to `add`: - ability SystemTime + structural ability SystemTime tomorrow : '{SystemTime} Nat ``` diff --git a/unison-src/transcripts/fix693.md b/unison-src/transcripts/fix693.md index 49661aff3..bcb714af9 100644 --- a/unison-src/transcripts/fix693.md +++ b/unison-src/transcripts/fix693.md @@ -4,10 +4,10 @@ ``` ```unison -ability X t where +structural ability X t where x : t -> a -> a -ability Abort where +structural ability Abort where abort : a ``` diff --git a/unison-src/transcripts/fix693.output.md b/unison-src/transcripts/fix693.output.md index 327115d8f..32fef56cd 100644 --- a/unison-src/transcripts/fix693.output.md +++ b/unison-src/transcripts/fix693.output.md @@ -1,9 +1,9 @@ ```unison -ability X t where +structural ability X t where x : t -> a -> a -ability Abort where +structural ability Abort where abort : a ``` @@ -15,8 +15,8 @@ ability Abort where ⍟ These new definitions are ok to `add`: - ability Abort - ability X t + structural ability Abort + structural ability X t ``` ```ucm @@ -24,8 +24,8 @@ ability Abort where ⍟ I've added these definitions: - ability Abort - ability X t + structural ability Abort + structural ability X t ``` This code should not type check. The match on X.x ought to introduce a diff --git a/unison-src/transcripts/fix987.md b/unison-src/transcripts/fix987.md index 28e39518d..0db69b1d7 100644 --- a/unison-src/transcripts/fix987.md +++ b/unison-src/transcripts/fix987.md @@ -6,7 +6,7 @@ First we'll add a definition: ```unison -ability DeathStar where +structural ability DeathStar where attack : Text -> () spaceAttack1 x = diff --git a/unison-src/transcripts/fix987.output.md b/unison-src/transcripts/fix987.output.md index ecf316953..f63416f52 100644 --- a/unison-src/transcripts/fix987.output.md +++ b/unison-src/transcripts/fix987.output.md @@ -2,7 +2,7 @@ First we'll add a definition: ```unison -ability DeathStar where +structural ability DeathStar where attack : Text -> () spaceAttack1 x = @@ -19,7 +19,7 @@ spaceAttack1 x = ⍟ These new definitions are ok to `add`: - ability DeathStar + structural ability DeathStar spaceAttack1 : x ->{DeathStar} Text ``` @@ -30,7 +30,7 @@ Add it to the codebase: ⍟ I've added these definitions: - ability DeathStar + structural ability DeathStar spaceAttack1 : x ->{DeathStar} Text ```