Skip to content

Commit 644cd91

Browse files
authored
Make unrestricted linear in the (!*) (#3506)
* Make `unrestricted` linear in its argument
1 parent 9e176f4 commit 644cd91

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ idris2docs_venv
4949
.\#*
5050
# VS Code
5151
.vscode/*
52+
# JetBrains IDEs
53+
.idea/
5254

5355
# macOS
5456
.DS_Store

CHANGELOG_NEXT.md

+2
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,8 @@ This CHANGELOG describes the merged but unreleased changes. Please see [CHANGELO
294294

295295
* Added `System.Concurrency.getThreadId` for the chez backend.
296296

297+
* `unrestricted`, for unpacking a `!* a`, now uses its argument once
298+
297299
#### Contrib
298300

299301
* `Data.Vect.Views.Extra` was moved from `contrib` to `base`.

libs/linear/Data/Linear/Notation.idr

+14-3
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,17 @@ public export
2121
export prefix 5 !*
2222
||| Prefix notation for the linear unrestricted modality
2323
public export
24-
record (!*) (a : Type) where
25-
constructor MkBang
26-
unrestricted : a
24+
data (!*) : Type -> Type where
25+
MkBang : a -> !* a
26+
27+
||| Unpack an unrestricted value in a linear context
28+
public export
29+
unrestricted : !* a -@ a
30+
unrestricted (MkBang unr) = unr
31+
32+
||| Unpack an unrestricted value in a linear context
33+
|||
34+
||| A postfix alias for function unrestricted.
35+
public export
36+
(.unrestricted) : !* a -@ a
37+
(.unrestricted) = unrestricted

0 commit comments

Comments
 (0)