mirror of
https://github.com/idris-lang/Idris2.git
synced 2024-11-23 22:22:07 +03:00
[ cleanup ] silence warnings in libs
This commit is contained in:
parent
0ee9632e45
commit
56009ad3ac
@ -74,7 +74,7 @@ length (x :: xs) = let () = consume x in Succ (length xs)
|
||||
|
||||
||| Fold a linear vector.
|
||||
export
|
||||
foldl : (0 f : acc -@ elem -@ acc) -> {auto 1 fns : n `Copies` f} -> acc -@ (LVect n elem) -@ acc
|
||||
foldl : (0 f : acc -@ a -@ acc) -> {auto 1 fns : n `Copies` f} -> acc -@ (LVect n a) -@ acc
|
||||
foldl _ {fns = []} acc [] = acc
|
||||
foldl f {fns = f :: fs} acc (x :: xs) = foldl f {fns = fs} (f acc x) xs
|
||||
|
||||
@ -94,4 +94,3 @@ export
|
||||
copiesToVect : {0 v : a} -> n `Copies` v -@ LVect n a
|
||||
copiesToVect [] = []
|
||||
copiesToVect (v :: copies) = v :: copiesToVect copies
|
||||
|
||||
|
@ -28,22 +28,23 @@ export
|
||||
data LChan : Protocol -> Type where
|
||||
MkLChan : {- pointer or something -@ -} LChan p
|
||||
|
||||
-- Assuming we have these primitives acting on channels
|
||||
send : LChan (Send a s) -@ a -@ LChan s
|
||||
recv : LChan (Recv a s) -@ LPair a (LChan s)
|
||||
close : LChan End -@ ()
|
||||
-- Fork relates inverse & duality
|
||||
fork : (0 s : Protocol) -> Inverse (LChan s) -@ LChan (Dual s)
|
||||
parameters
|
||||
-- Assuming we have these primitives acting on channels
|
||||
(send : forall s, a. LChan (Send a s) -@ a -@ LChan s)
|
||||
(recv : forall s, a. LChan (Recv a s) -@ LPair a (LChan s))
|
||||
(close : LChan End -@ ())
|
||||
-- Fork relates inverse & duality
|
||||
(fork : (0 s : Protocol) -> Inverse (LChan s) -@ LChan (Dual s))
|
||||
|
||||
-- We can write double negation elimination by communicating
|
||||
involOp : Inverse (Inverse a) -@ a
|
||||
involOp k =
|
||||
let 0 P : Protocol
|
||||
P = Send a End
|
||||
1 r : LChan (Dual P)
|
||||
:= fork P $ mkInverse $ \ s =>
|
||||
(`divide` k) $ mkInverse $
|
||||
\ x => let 1 c = send s x in close c
|
||||
(x # c') := recv r
|
||||
() := close c'
|
||||
in x
|
||||
-- We can write double negation elimination by communicating
|
||||
involOp : Inverse (Inverse a) -@ a
|
||||
involOp k =
|
||||
let 0 P : Protocol
|
||||
P = Send a End
|
||||
1 r : LChan (Dual P)
|
||||
:= fork P $ mkInverse $ \ s =>
|
||||
(`divide` k) $ mkInverse $
|
||||
\ x => let 1 c = send s x in close c
|
||||
(x # c') := recv r
|
||||
() := close c'
|
||||
in x
|
||||
|
Loading…
Reference in New Issue
Block a user