fixes tests and transcripts

This commit is contained in:
rlmark 2021-08-24 11:33:27 -07:00
parent 5da63ec4f1
commit ac2bc29849
138 changed files with 311 additions and 308 deletions

View File

@ -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

View File

@ -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)
|]

View File

@ -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} ()"
]

View File

@ -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
```

View File

@ -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" ++

View File

@ -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 []

View File

@ -2,5 +2,4 @@ increment : Nat -> Nat
increment n = n + 1
> x = 1 + 40
> increment x
> increment x

View File

@ -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 ""

View File

@ -1,5 +1,5 @@
--Abort
ability Abort where
structural ability Abort where
Abort : forall a . () -> {Abort} a
bork = u -> 1 + (Abort.Abort ())

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -1,4 +1,4 @@
ability T where
structural ability T where
a : Unknown -> {T} ()
--b : Unknown

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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} ()

View File

@ -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

View File

@ -1,5 +1,5 @@
type Foo = Foo
type Bar = Bar
structural type Foo = Foo
structural type Bar = Bar
x : Foo
x = Bar.Bar

View File

@ -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

View File

@ -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

View File

@ -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"

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -1,4 +1,4 @@
ability State s where
structural ability State s where
get : () -> {State s} s
set : s -> {State s} ()

View File

@ -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"

View File

@ -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

View File

@ -1,4 +1,4 @@
type Optional a = Some a | None
structural type Optional a = Some a | None
app' : Optional Int
app' = 3
()

View File

@ -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

View File

@ -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

View File

@ -1,4 +1,4 @@
type Optional a = Some a | None
structural type Optional a = Some a | None
y : (Optional Int)
y = 3
()

View File

@ -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)

View File

@ -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
()

View File

@ -1,5 +1,5 @@
--Abort
ability Abort where
structural ability Abort where
Abort : forall a . () -> {Abort} a
use Nat +

View File

@ -1,5 +1,5 @@
ability Ask a where
structural ability Ask a where
ask : {Ask a} a
supply : Text -> Request (Ask Text) a -> a

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -1,7 +1,6 @@
ability Foo where
structural ability Foo where
foo : {Foo} Text
x = 'let
y = Foo.foo
()
()

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -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} ()

View File

@ -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} ()

View File

@ -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]

View File

@ -1,5 +1,5 @@
type Foo a = Foo a
structural type Foo a = Foo a
(+) = (Nat.+)

View File

@ -1,4 +1,4 @@
ability T where
structural ability T where
foo : {T} ()
-- parses fine

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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:

View File

@ -1,5 +1,5 @@
ability G a where
structural ability G a where
get : a
f x y =

View File

@ -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

View File

@ -1,4 +1,4 @@
type MonoidRec a = {
structural type MonoidRec a = {
combine : a -> a -> a,
empty : a
}

View File

@ -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

View File

@ -1,4 +1,4 @@
type Foo = Foo Boolean Boolean
structural type Foo = Foo Boolean Boolean
f : Foo -> Boolean
f = cases

View File

@ -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)

View File

@ -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

View File

@ -1,5 +1,4 @@
id : a -> a
id x = x
> id
> id

View File

@ -1,2 +1,2 @@
foo = if true then true else false
> foo
> foo

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -1,5 +1,5 @@
ability SpaceAttack where
structural ability SpaceAttack where
launchMissiles : Text -> ()
-- should typecheck fine, as the `launchMissiles "saturn"`

View File

@ -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])

View File

@ -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} ()

View File

@ -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

View File

@ -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

View File

@ -1,4 +1,4 @@
type Value = String Text
structural type Value = String Text
| Bool Boolean
f : Value -> Nat

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -1,4 +1,4 @@
type X a = X [a]
structural type X a = X [a]
f : X a -> a
f = cases

View File

@ -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

View File

@ -1,4 +1,4 @@
ability Woot where
structural ability Woot where
woot : {Woot} Nat
wha : ((a ->{Woot} a) -> a ->{Woot} a) -> Nat

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -1,4 +1,4 @@
ability State s where
structural ability State s where
put : s -> {State s} ()
get : {State s} s

View File

@ -1,4 +1,4 @@
ability State s where
structural ability State s where
put : s -> {State s} ()
get : {State s} s

View File

@ -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

View File

@ -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

View File

@ -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
---

View File

@ -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

View File

@ -1,6 +1,6 @@
-- board piece
type Board = Board Nat Nat Nat
structural type Board = Board Nat Nat Nat
use Board Board

View File

@ -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

Some files were not shown because too many files have changed in this diff Show More