GithubHelp home page GithubHelp logo

base's People

Contributors

ceedubs avatar rlmark avatar runarorama avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

base's Issues

Delete `readLine` for now

It hasn't been merged into a release yet. IIRC there were still some questions about how it should work exactly that we didn't get sorted before M2.

Merge new IO, update base to use Exception

Updates:

1.   ability Exception e

     ↓
2.   ability Exception
         - 3.   unisoncomputing2020 : License
         - 4.   pchiusano           : Author

5.   unique type io.BufferMode

     ↓
6.   unique type io.BufferMode


7.   unique type io.Handle

     ↓
8.   builtin type io.Handle


9.   ability io.IO

     ↓
10.  builtin ability io.IO


11.  unique type io.SeekMode

     ↓
12.  unique type io.SeekMode


13.  unique type io.Socket

     ↓
14.  builtin type io.Socket


15.  unique type io.ThreadId

     ↓
16.  builtin type io.ThreadId


17.  . : (b ->{𝕖} c) -> (a ->{𝕖} b) -> a ->{𝕖} c
     + 18.  unisoncomputing2020 : License
     + 19.  authors.stew        : Author

20.  Either.toException : Either e a ->{Throw e} a
     ↓
21.  Either.toException : Either Failure a ->{bbase.Exception} a
     - 22.  pchiusano           : Author
     + 23.  unisoncomputing2020 : License
     + 24.  authors.stew        : Author

25.  Exception.raise : e ->{Throw e} a
     ↓
26.  Exception.raise : Failure ->{bbase.Exception} x
     - 27.  unisoncomputing2020 : License
     - 28.  pchiusano           : Author

29.  patch patch (added 3 updates)

Added definitions:

30.  builtin type io.Tls.Cipher
31.  builtin type io.Tls.Version
32.  ┌ Either.toException           : Either Failure a ->{bbase.Exception} a (+2 metadata)
33.  └ Exception.reraise            : Either Failure a ->{bbase.Exception} a
34.  Text.fromUtf8                  : Bytes ->{bbase.Exception} Text (+2 metadata)
35.  compose2                       : (c ->{𝕖} d)
                                    -> (a ->{𝕖} b ->{𝕖} c)
                                    -> a
                                    -> b
                                    ->{𝕖} d (+3 metadata)
36.  compose3                       : (d ->{e} e)
                                    -> (a ->{e} b ->{e} c ->{e} d)
                                    -> a
                                    -> b
                                    -> c
                                    ->{e} e (+3 metadata)
37.  io.IO.clientSocket             : Text
                                    -> Text
                                    ->{io2.IO, bbase.Exception} io2.Socket (+1 metadata)
38.  io.IO.closeFile                : io2.Handle ->{io2.IO, bbase.Exception} ()
39.  io.IO.closeSocket              : io2.Socket ->{io2.IO, bbase.Exception} ()
40.  io.IO.createDirectory          : Text ->{io2.IO, bbase.Exception} ()
41.  io.IO.delay                    : Nat ->{io2.IO, bbase.Exception} ()
42.  io.IO.fileExists               : Text ->{io2.IO, bbase.Exception} Boolean
43.  io.IO.getBuffering             : io2.Handle ->{io2.IO, bbase.Exception} io2.BufferMode
44.  io.IO.getBytes                 : io2.Handle
                                    -> Nat
                                    ->{io2.IO, bbase.Exception} Bytes (+1 metadata)
45.  io.IO.getCurrentDirectory      : '{io2.IO, bbase.Exception} Text
46.  io.IO.getFileSize              : Text ->{io2.IO, bbase.Exception} Nat
47.  io.IO.getFileTimestamp         : Text ->{io2.IO, bbase.Exception} Nat
48.  io.IO.getTempDirectory         : '{io2.IO, bbase.Exception} Text
49.  io.IO.handlePosition           : io2.Handle ->{io2.IO, bbase.Exception} Nat
50.  io.IO.isDirectory              : Text ->{io2.IO, bbase.Exception} Boolean
51.  io.IO.isFileEOF                : io2.Handle ->{io2.IO, bbase.Exception} Boolean
52.  io.IO.isFileOpen               : io2.Handle ->{io2.IO, bbase.Exception} Boolean
53.  io.IO.isSeekable               : io2.Handle ->{io2.IO, bbase.Exception} Boolean
54.  io.IO.kill                     : io2.ThreadId ->{io2.IO, bbase.Exception} ()
55.  io.IO.listen                   : io2.Socket ->{io2.IO, bbase.Exception} ()
56.  io.IO.openFile                 : Text
                                    -> FileMode
                                    ->{io2.IO, bbase.Exception} io2.Handle (+1 metadata)
57.  io.IO.putBytes                 : io2.Handle
                                    -> Bytes
                                    ->{io2.IO, bbase.Exception} () (+1 metadata)
58.  io.IO.removeDirectory          : Text ->{io2.IO, bbase.Exception} ()
59.  io.IO.removeFile               : Text ->{io2.IO, bbase.Exception} ()
60.  io.IO.renameDirectory          : Text -> Text ->{io2.IO, bbase.Exception} () (+1 metadata)
61.  io.IO.renameFile               : Text -> Text ->{io2.IO, bbase.Exception} () (+1 metadata)
62.  io.IO.seekHandle               : io2.Handle
                                    -> io2.SeekMode
                                    -> Int
                                    ->{io2.IO, bbase.Exception} () (+2 metadata)
63.  io.IO.serverSocket             : Optional Text
                                    -> Text
                                    ->{io2.IO, bbase.Exception} io2.Socket (+1 metadata)
64.  io.IO.setBuffering             : io2.Handle
                                    -> io2.BufferMode
                                    ->{io2.IO, bbase.Exception} () (+1 metadata)
65.  io.IO.setCurrentDirectory      : Text ->{io2.IO, bbase.Exception} ()
66.  io.IO.socketAccept             : io2.Socket ->{io2.IO, bbase.Exception} io2.Socket
67.  io.IO.socketReceive            : io2.Socket
                                    -> Nat
                                    ->{io2.IO, bbase.Exception} Bytes (+1 metadata)
68.  io.IO.socketSend               : io2.Socket
                                    -> Bytes
                                    ->{io2.IO, bbase.Exception} () (+1 metadata)
69.  io.MVar.put                    : MVar a -> a ->{io2.IO, bbase.Exception} () (+1 metadata)
70.  io.MVar.read                   : MVar a ->{io2.IO, bbase.Exception} a
71.  io.MVar.swap                   : MVar a -> a ->{io2.IO, bbase.Exception} a (+1 metadata)
72.  io.MVar.take                   : MVar a ->{io2.IO, bbase.Exception} a
73.  metadata.authors.stew          : Author
74.  metadata.authors.stew.guid     : GUID
75.  metadata.copyrightHolders.stew : CopyrightHolder

Name changes:

Original                                      Changes
76.  Exception                                77.  Throw (added)
                                              78.  Exception (removed)

79.  io2.BufferMode                           80.  io.BufferMode (added)

81.  io2.Failure                              82.  io.Failure (added)

83.  io2.FileMode                             84.  io.FileMode (added)

85.  io2.Handle                               86.  io.Handle (added)

87.  io2.IO                                   88.  io.IO (added)

89.  io2.IOError                              90.  io.IOError (added)

91.  io2.IOFailure                            92.  io.IOFailure (added)

93.  io2.MVar                                 94.  io.MVar (added)

95.  io2.STM                                  96.  io.STM (added)

97.  io2.SeekMode                             98.  io.SeekMode (added)

99.  io2.Socket                               100. io.Socket (added)

101. io2.StdHandle                            102. io.StdHandle (added)

103. io2.TVar                                 104. io.TVar (added)

105. io2.ThreadId                             106. io.ThreadId (added)

107. io2.Tls                                  108. io.Tls (added)

109. io2.Tls.ClientConfig                     110. io.Tls.ClientConfig (added)

111. io2.Tls.PrivateKey                       112. io.Tls.PrivateKey (added)

113. io2.Tls.ServerConfig                     114. io.Tls.ServerConfig (added)

115. io2.Tls.SignedCert                       116. io.Tls.SignedCert (added)

117. io2.TlsFailure                           118. io.TlsFailure (added)

119. .                                        120. compose (added)

121. Either.toException                       122. Either.toThrow (added)
                                              123. Either.toException (removed)

124. Exception.raise                          125. Throw.raise (added)
                                              126. Exception.raise (removed)

127. Exception.tests.ex1                      128. Throw.tests.ex1 (added)

129. Exception.tests.ex2                      130. Throw.tests.ex2 (added)

131. Exception.tests.ex3                      132. Throw.tests.ex3 (added)

133. Exception.toEither                       134. Throw.toEither (added)

135. Exception.toEither.handler               136. Throw.toEither.handler (added)

137. io2.BufferMode.BlockBuffering            138. io.BufferMode.BlockBuffering (added)

139. io2.BufferMode.LineBuffering             140. io.BufferMode.LineBuffering (added)

141. io2.BufferMode.NoBuffering               142. io.BufferMode.NoBuffering (added)

143. io2.BufferMode.SizedBlockBuffering       144. io.BufferMode.SizedBlockBuffering (added)

145. io2.Failure.Failure                      146. io.Failure.Failure (added)

147. io2.FileMode.Append                      148. io.FileMode.Append (added)

149. io2.FileMode.Read                        150. io.FileMode.Read (added)

151. io2.FileMode.ReadWrite                   152. io.FileMode.ReadWrite (added)

153. io2.FileMode.Write                       154. io.FileMode.Write (added)

155. io2.IO.clientSocket.impl                 156. io.IO.clientSocket.impl (added)

157. io2.IO.closeFile.impl                    158. io.IO.closeFile.impl (added)

159. io2.IO.closeSocket.impl                  160. io.IO.closeSocket.impl (added)

161. io2.IO.createDirectory.impl              162. io.IO.createDirectory.impl (added)

163. io2.IO.createTempDirectory.impl          164. io.IO.createTempDirectory (added)

165. io2.IO.delay.impl                        166. io.IO.delay.impl (added)

167. io2.IO.fileExists.impl                   168. io.IO.fileExists.impl (added)

169. io2.IO.forkComp                          170. io.IO.forkComp (added)

171. io2.IO.getBuffering.impl                 172. io.IO.getBuffering.impl (added)

173. io2.IO.getBytes.impl                     174. io.IO.getBytes.impl (added)

175. io2.IO.getCurrentDirectory.impl          176. io.IO.getCurrentDirectory.impl (added)

177. io2.IO.getFileSize.impl                  178. io.IO.getFileSize.impl (added)

179. io2.IO.getFileTimestamp.impl             180. io.IO.getFileTimestamp.impl (added)

181. io2.IO.getTempDirectory.impl             182. io.IO.getTempDirectory.impl (added)

183. io2.IO.handlePosition.impl               184. io.IO.handlePosition.impl (added)

185. io2.IO.isDirectory.impl                  186. io.IO.isDirectory.impl (added)

187. io2.IO.isFileEOF.impl                    188. io.IO.isFileEOF.impl (added)

189. io2.IO.isFileOpen.impl                   190. io.IO.isFileOpen.impl (added)

191. io2.IO.isSeekable.impl                   192. io.IO.isSeekable.impl (added)

193. io2.IO.kill.impl                         194. io.IO.kill.impl (added)

195. io2.IO.listen.impl                       196. io.IO.listen.impl (added)

197. io2.IO.openFile.impl                     198. io.IO.openFile.impl (added)

199. io2.IO.putBytes.impl                     200. io.IO.putBytes.impl (added)

201. io2.IO.removeDirectory.impl              202. io.IO.removeDirectory.impl (added)

203. io2.IO.removeFile.impl                   204. io.IO.removeFile.impl (added)

205. io2.IO.renameDirectory.impl              206. io.IO.renameDirectory.impl (added)

207. io2.IO.renameFile.impl                   208. io.IO.renameFile.impl (added)

209. io2.IO.seekHandle.impl                   210. io.IO.seekHandle.impl (added)

211. io2.IO.serverSocket.impl                 212. io.IO.serverSocket.impl (added)

213. io2.IO.setBuffering.impl                 214. io.IO.setBuffering.impl (added)

215. io2.IO.setCurrentDirectory.impl          216. io.IO.setCurrentDirectory.impl (added)

217. io2.IO.socketAccept.impl                 218. io.IO.socketAccept.impl (added)

219. io2.IO.socketPort.impl                   220. io.IO.socketPort (added)

221. io2.IO.socketReceive.impl                222. io.IO.socketReceive.impl (added)

223. io2.IO.socketSend.impl                   224. io.IO.socketSend.impl (added)

225. io2.IO.stdHandle                         226. io.IO.stdHandle (added)

227. io2.IO.systemTime.impl                   228. io.IO.systemTime.impl (added)

229. io2.IOError.AlreadyExists                230. io.IOError.AlreadyExists (added)

231. io2.IOError.EOF                          232. io.IOError.EOF (added)

233. io2.IOError.IllegalOperation             234. io.IOError.IllegalOperation (added)

235. io2.IOError.NoSuchThing                  236. io.IOError.NoSuchThing (added)

237. io2.IOError.PermissionDenied             238. io.IOError.PermissionDenied (added)

239. io2.IOError.ResourceBusy                 240. io.IOError.ResourceBusy (added)

241. io2.IOError.ResourceExhausted            242. io.IOError.ResourceExhausted (added)

243. io2.IOError.UserError                    244. io.IOError.UserError (added)

245. io2.MVar.isEmpty                         246. io.MVar.isEmpty (added)

247. io2.MVar.new                             248. io.MVar.new (added)

249. io2.MVar.newEmpty                        250. io.MVar.newEmpty (added)

251. io2.MVar.put.impl                        252. io.MVar.put.impl (added)

253. io2.MVar.read.impl                       254. io.MVar.read.impl (added)

255. io2.MVar.swap.impl                       256. io.MVar.swap.impl (added)

257. io2.MVar.take.impl                       258. io.MVar.take.impl (added)

259. io2.MVar.tryPut.impl                     260. io.MVar.tryPut (added)

261. io2.MVar.tryRead.impl                    262. io.MVar.tryRead (added)

263. io2.MVar.tryTake                         264. io.MVar.tryTake (added)

265. io2.STM.atomically                       266. io.STM.atomically (added)

267. io2.STM.retry                            268. io.STM.retry (added)

269. io2.SeekMode.AbsoluteSeek                270. io.SeekMode.AbsoluteSeek (added)

271. io2.SeekMode.RelativeSeek                272. io.SeekMode.RelativeSeek (added)

273. io2.SeekMode.SeekFromEnd                 274. io.SeekMode.SeekFromEnd (added)

275. io2.StdHandle.StdErr                     276. io.StdHandle.StdErr (added)

277. io2.StdHandle.StdIn                      278. io.StdHandle.StdIn (added)

279. io2.StdHandle.StdOut                     280. io.StdHandle.StdOut (added)

281. io2.TLS.ClientConfig.ciphers.set         282. io.TLS.ClientConfig.ciphers.set (added)

283. io2.TVar.new                             284. io.TVar.new (added)

285. io2.TVar.newIO                           286. io.TVar.newIO (added)

287. io2.TVar.read                            288. io.TVar.read (added)

289. io2.TVar.readIO                          290. io.TVar.readIO (added)

291. io2.TVar.swap                            292. io.TVar.swap (added)

293. io2.TVar.write                           294. io.TVar.write (added)

295. io2.Tls.ClientConfig.certificates.set    296. io.Tls.ClientConfig.certificates.set (added)

297. io2.Tls.ClientConfig.default             298. io.Tls.ClientConfig.default (added)

299. io2.Tls.ClientConfig.versions.set        300. io.Tls.ClientConfig.versions.set (added)

301. io2.Tls.ServerConfig.certificates.set    302. io.Tls.ServerConfig.certificates.set (added)

303. io2.Tls.ServerConfig.ciphers.set         304. io.Tls.ServerConfig.ciphers.set (added)

305. io2.Tls.ServerConfig.default             306. io.Tls.ServerConfig.default (added)

307. io2.Tls.ServerConfig.versions.set        308. io.Tls.ServerConfig.versions.set (added)

309. io2.Tls.decodeCert.impl                  310. io.Tls.decodeCert (added)

311. io2.Tls.decodePrivateKey                 312. io.Tls.decodePrivateKey (added)

313. io2.Tls.encodeCert                       314. io.Tls.encodeCert (added)

315. io2.Tls.encodePrivateKey                 316. io.Tls.encodePrivateKey (added)

317. io2.Tls.handshake.impl                   318. io.Tls.handshake (added)

319. io2.Tls.newClient.impl                   320. io.Tls.newClient (added)

321. io2.Tls.newServer.impl                   322. io.Tls.newServer (added)

323. io2.Tls.receive.impl                     324. io.Tls.receive (added)

325. io2.Tls.send.impl                        326. io.Tls.send (added)

327. io2.Tls.terminate.impl                   328. io.Tls.terminate (added)

[DRAFT] Add `duration` library for representing finite durations.

TODO:

  • Docs
  • Tests
  • Link metadata

Before submitting a pull request, please doublecheck that you have included

  • a clear PR description (don't bother to include issues numbers).
  • Docs linked for types and terms as needed
  • Author and License metadata linked
  • Tests, where appropriate

Code review

The changes summarized below are available for you to review, using the following command:

pull-request.load https://github.com/unisonweb/base:.trunk https://github.com/ChrisPenner/unison-codebase:.prs.base._duration

Added definitions:

 unique type duration.Duration
 duration.Duration.Nanosecond      : Nat -> Duration
 duration.!=                       : Duration -> Duration -> Boolean
 duration.%                        : Duration -> Duration -> Duration
 duration.*                        : Nat -> Duration -> Duration
 duration.+                        : Duration -> Duration -> Duration
 duration.-                        : Duration -> Duration -> Duration
 duration.<                        : Duration -> Duration -> Boolean
 duration.<=                       : Duration -> Duration -> Boolean
 duration.==                       : Duration -> Duration -> Boolean
 duration.>                        : Duration -> Duration -> Boolean
 duration.>=                       : Duration -> Duration -> Boolean
 duration.asHours                  : Duration -> Nat
 duration.asMicroseconds           : Duration -> Nat
 duration.asMilliseconds           : Duration -> Nat
 duration.asMinutes                : Duration -> Nat
 duration.asNanoseconds            : Duration -> Nat
 duration.asSeconds                : Duration -> Nat
 duration.displayDuration          : Duration -> Text
 duration.-.doc                    : Doc
 duration.Duration.doc             : Doc
 duration.asHours.doc              : Doc
 duration.asMicroseconds.doc       : Doc
 duration.asMilliseconds.doc       : Doc
 duration.asMinutes.doc            : Doc
 duration.asNanoseconds.doc        : Doc
 duration.asSeconds.doc            : Doc
 duration.displayDuration.doc      : Doc (+1 metadata)
 duration.hour                     : Duration
 duration.microsecond              : Duration
 duration.millisecond              : Duration
 duration.minute                   : Duration
 duration.nanosecond               : Duration
 duration.Duration.tests.roundtrip : [Result] (+1 metadata)
 duration.second                   : Duration

failing tests for Map.intersectWith

I pull https://github.com/unisonweb/base:.releases._latest .base_v2 while trying out M2, run test, and I see a couple of failing tests.

  ✗ Map.intersectWith.tests.commutative      
  ✗ Map.intersectWithKey.tests.commutative   
  
  🚫 2 test(s) failing, ✅ 300 test(s) passing

tagging @runarorama

Convert from Doc.Deprecated to Doc

There's currently not a good way of converting from the old documentation format to the new. This should be straightforward to address with a function of type Doc.Deprecated -> Doc.

Convert `Random` ability to `unique`

.prs.uniqueRandom> squash .prs.uniqueRandom .prs.clean.uniqueRandom

Here's what's changed in .prs.clean.uniqueRandom after the merge:

Updates:

1.  ability Random           
    ↓
2.  unique ability Random
       + 3.  unisoncomputing2021 : License
       + 4.  pchiusano           : Author
       + 5.  runarorama          : Author

6.  Random.Readme : Doc
    ↓
7.  Random.Readme : Doc
    + 8.  unisoncomputing2021 : License
    + 9.  pchiusano           : Author

10. Random.bytes : Nat ->{_base.Random} Bytes
    ↓
11. Random.bytes : Nat ->{Random} Bytes

12. Random.bytes.doc : Doc
    ↓
13. Random.bytes.doc : Doc
    + 14. unisoncomputing2021 : License
    + 15. pchiusano           : Author

16. Random.lcg : Nat -> '{g, _base.Random} a ->{g} a
    ↓
17. Random.lcg : Nat -> '{g, Random} t ->{g} t
    + 18. unisoncomputing2021 : License
    + 19. pchiusano           : Author

20. Random.lcg.handler : Nat -> Request {_base.Random} a -> a
    ↓
21. Random.lcg.handler : Nat -> Request {Random} a -> a
    + 22. unisoncomputing2021 : License
    + 23. pchiusano           : Author

24. Random.nat! : {_base.Random} Nat
    ↓
25. Random.nat! : {Random} Nat

26. Random.split! : {_base.Random} (∀ g a. '{g, _base.Random} a ->{g} a)
    ↓
27. Random.split! : {Random} (∀ g a. '{g, Random} a ->{g} a)

28. Random.splitmix : Nat -> '{g, _base.Random} a ->{g} a
    ↓
29. Random.splitmix : Nat -> '{g, Random} t ->{g} t
    + 30. unisoncomputing2021 : License
    + 31. oleggrenrus         : Author
    + 32. pchiusano           : Author

There were 8 auto-propagated updates.

33. patch patch (added 8 updates)

Added definitions:

34. metadata.authors.oleggrenrus      : Author
35. metadata.authors.oleggrenrus.guid : GUID

Tip: You can use todo to see if this generated any work to do in this namespace and test to
run the tests. Or you can use undo or reflog to undo the results of this merge.

Implemented `TMVar` and associated functions

The changes summarized below are available for you to review, using the
following command:

pull-request.load https://github.com/unisonweb/base:.trunk https://github.

com/dolio/unison-base-contrib:.work.tmvar

Added definitions:

 type io.TMVar a (+2 metadata)
 io.TMVar.TMVar          : TVar (Optional a) -> TMVar a
 io.TMVar.doc            : Doc (+2 metadata)
 io.TMVar.isEmpty        : TMVar a ->{STM} Boolean (+2 metadata)
 io.TMVar.isEmpty.doc    : Doc (+2 metadata)
 io.TMVar.new            : a ->{STM} TMVar a (+2 metadata)
 io.TMVar.new.doc        : Doc (+2 metadata)
 io.TMVar.newEmpty       : '{STM} TMVar a (+2 metadata)
 io.TMVar.newEmpty.doc   : Doc (+2 metadata)
 io.TMVar.newEmptyIO     : '{IO} TMVar a (+2 metadata)
 io.TMVar.newEmptyIO.doc : Doc (+2 metadata)
 io.TMVar.newIO          : a ->{IO} TMVar a (+2 metadata)
 io.TMVar.newIO.doc      : Doc (+2 metadata)
 io.TMVar.put            : TMVar a -> a ->{STM} () (+2 metadata)
 io.TMVar.put.doc        : Doc (+2 metadata)
 io.TMVar.read           : TMVar a ->{STM} a (+2 metadata)
 io.TMVar.read.doc       : Doc (+2 metadata)
 io.TMVar.swap           : TMVar a -> a ->{STM} a (+2 metadata)
 io.TMVar.swap.doc       : Doc (+2 metadata)
 io.TMVar.take           : TMVar a ->{STM} a (+2 metadata)
 io.TMVar.take.doc       : Doc (+2 metadata)
 io.TMVar.tryPut         : TMVar a -> a ->{STM} Boolean (+2 metadata)
 io.TMVar.tryPut.doc     : Doc (+2 metadata)
 io.TMVar.tryRead        : TMVar a ->{STM} Optional a (+2 metadata)
 io.TMVar.tryRead.doc    : Doc (+2 metadata)
 io.TMVar.tryTake        : TMVar a ->{STM} Optional a (+2 metadata)
 io.TMVar.tryTake.doc    : Doc (+2 metadata)

Little-endian `Nat` encoding and decoding

I wanted these for some random number generation stuff.

pull-request.load [email protected]:unisonweb/base:.trunk [email protected]:pchiusano/unisoncode:.prs.natHelpers

Added definitions:

 Bytes.at!                         : Nat -> Bytes ->{Abort} Nat (+2 metadata)
 Bytes.at!.doc                     : Doc (+2 metadata)
 Nat.fromBytesLittleEndian         : Bytes ->{Abort} Nat (+2 metadata)
 Nat.fromBytesLittleEndian.doc     : Doc (+2 metadata)
 Nat.toBytesLittleEndian           : Nat -> Bytes (+2 metadata)
 Nat.toBytesLittleEndian.doc       : Doc (+2 metadata)
 Nat.toBytesLittleEndian.test.ex1  : [Result] (+3 metadata)
 Nat.toBytesLittleEndian.test.prop : [Result] (+3 metadata)
.prs.natHelpers> docs Bytes.at!

  `at! i bs` returns the `i`-th (0-based) byte in `bs` and calls abort if the index is out of
  bounds.
  
  # Examples
  
        toOptional '(at! 9 Bytes.empty)
        ⧨
        None
  
        toOptional '(at! 1 0xs1122334455)
        ⧨
        Some 34

.prs.natHelpers> docs Nat.toBytesLittleEndian

  Convert a Nat to its Bytes, in little endian order.
  
  The resulting Bytes will always have size 8.
  
  # Examples
  
        toBytesLittleEndian 1 Universal.=== 0xs0000000000000001
        ⧨
        true
  
        toBytesLittleEndian (Nat.shiftLeft 1 60) Universal.=== 0xs1000000000000000
        ⧨
        true
  
        toBytesLittleEndian 18446744073709551615 Universal.=== 0xsffffffffffffffff
        ⧨
        true
  
  # See also
  
    * fromBytesLittleEndian which converts in the other direction

.prs.natHelpers> docs Nat.fromBytesLittleEndian

  Reads a Nat from a Bytes, assuming most significant bytes come first.
  
  Calls abort if the input has size less than 8.
  
  # Examples
  
        toOptional '(fromBytesLittleEndian (toBytesLittleEndian 2))
        ⧨
        Some 2
  
        toOptional '(fromBytesLittleEndian (toBytesLittleEndian 93948238))
        ⧨
        Some 93948238
  
    In this example, the function is only given 1 byte, so it does abort:
  
        toOptional '(fromBytesLittleEndian 0xs00)
        ⧨
        None

Draft: new Abort/Store/Optional functions

  • This PR renames Abort.toDefault! -> Abort.toDefaultValue! and repurposes Abort.toDefault! to take a delayed computation as a default instead of a default value. It also renames Abort.toDefault -> Abort.toDefaultValue and repurposes Abort.toDefault for the delayed version of Abort.toDefault!. An Optional.getOrElse' function, which takes a delayed default, is also added.
  • The PR also renames the sort-of-useless definition of Store.local to Store.local.deprecated ("useless", because Store.withInitialValue could just be used instead) and introduces Store.local! for a function that allows one to operate on a partial state, given getter/setter functions for the whole state. A similar Store.focus! function is also introduced that uses a Lens type to encapsulate the getter/setter. Store.local is repurposed for the delayed version of Store.local!, and Store.focus provides a delayed version of Store.focus!.

Code review

The changes summarized below are available for you to review, using the following command:

pull-request.load https://github.com/unisonweb/base:.trunk https://github.com/anovstrup/unison-all:.prs.base.abort

Updates:

 Abort.toDefault : a -> '{g, Abort} a -> '{g} a
 ↓
 Abort.toDefault : '{g} a -> '{g, Abort} a -> '{g} a
 +  licenses.mit_2020 : License
 +  author            : Author

 Abort.toDefault! : a -> '{g, Abort} a ->{g} a
 ↓
 Abort.toDefault! : '{g} a -> '{g, Abort} a ->{g} a
 +  licenses.mit_2020 : License
 +  author            : Author

 Abort.toDefault!.doc : Doc
 ↓
 Abort.toDefault!.doc : Doc
 -  authors.jamessully  : Author
 -  licenses.jamessully : License
 +  licenses.mit_2020   : License
 +  author              : Author

 Abort.toDefault!.handler : a -> Request {Abort} a -> a
 ↓
 Abort.toDefault!.handler : '{g} a -> Request {Abort} a ->{g} a
 +  licenses.mit_2020 : License
 +  author            : Author

 Abort.toDefault.doc : Doc
 ↓
 Abort.toDefault.doc : Doc
 +  licenses.mit_2020   : License
 +  authors.jamessully  : Author
 +  author              : Author
 +  licenses.jamessully : License

 Store.local : a -> '{g, Store a} v ->{g, Store a} v
 ↓
 Store.local : (a ->{g} b) -> (a ->{g} b ->{g} a) -> '{g, Store b} v -> '{g, Store a} v
 -  deprecated.doc    : Doc.Deprecated
 +  licenses.mit_2020 : License
 +  author            : Author

 Store.local.doc : Doc.Deprecated
 ↓
 Store.local.doc : Doc
 +  licenses.mit_2020 : License
 +  author            : Author

Added definitions:

 Optional.getOrElse'.doc   : Doc (+2 metadata)
 Store.local!.doc          : Doc (+2 metadata)
 Abort.toDefaultValue.doc  : Doc (+2 metadata)
 Abort.toDefaultValue!.doc : Doc (+4 metadata)
 Store.local!.examples.ex1 : (Text, Nat) (+2 metadata)
 Store.local!.tests.ex1    : [Result] (+3 metadata)
 Optional.getOrElse'       : '{e} a -> Optional a ->{e} a (+2 metadata)
 Store.local!              : (a ->{g} b)
                           -> (a ->{g} b ->{g} a)
                           -> '{g, Store b} v
                           ->{g, Store a} v (+2 metadata)

Name changes:

Original                     Changes
 Store.local.doc              Store.local.deprecated.doc (added)
                              Store.local.doc (removed)

 Store.local.examples.ex1     Store.local.deprecated.examples.ex1 (added)
                              Store.local.examples.ex1 (removed)

 Abort.toDefault!.handler     Abort.toDefaultValue!.handler (added)
                              Abort.toDefault!.handler (removed)

 Store.local                  Store.local.deprecated (added)
                              Store.local (removed)

 Store.local.test             Store.local.deprecated.test (added)
                              Store.local.test (removed)

 Abort.toDefault              Abort.toDefaultValue (added)
                              Abort.toDefault (removed)

 Abort.toDefault!             Abort.toDefaultValue! (added)
                              Abort.toDefault! (removed)

Store.unfold, List.iterate, Stream.iterate

Also includes some changes from @anovstrup to Abort.

Code review

The changes summarized below are available for you to review, using the following command:

pull-request.load https://github.com/unisonweb/base:.trunk https://github.com/sullyj3/myUnisonCodebase:.prs.base.unfoldStore

Updates:

 Abort.toOptional : '{g, Abort} a ->{g} Optional a
 ↓
 Abort.toOptional : '{g, Abort} a -> '{g} Optional a
 -  unisoncomputing2020 : License
 -  pchiusano           : Author
 +  anovstrup.mit_2020  : License
 +  authors.anovstrup   : Author

There were 27 auto-propagated updates.

 patch patch (added 3 updates)

Added definitions:

 List.iterate.doc                     : Doc (+3 metadata)
 Stream.iterate.doc                   : Doc (+2 metadata)
 Stream.iterate!.doc                  : Doc (+2 metadata)
 Abort.toDefault.doc                  : Doc (+2 metadata)
 Abort.toDefault!.doc                 : Doc (+2 metadata)
 Abort.toOptional.doc                 : Doc (+2 metadata)
 Abort.toOptional!.doc                : Doc (+2 metadata)
 Store.unfold!.doc                    : Doc (+3 metadata)
 List.iterate.tests.ex1               : [Result] (+3 metadata)
 Stream.iterate.tests.ex1             : [Result] (+3 metadata)
 Store.unfold!.tests.ex1              : [Result] (+4 metadata)
 metadata.authors.jamessully.guid     : GUID
 Abort.toDefault!.handler             : a -> Request {Abort} a -> a (+2 metadata)
 List.iterate                         : (a ->{Abort} a) -> a -> [a] (+2 metadata)
 Stream.iterate                       : (a ->{g} a) -> a -> '{g, Stream a} () (+2 metadata)
 Stream.iterate!                      : (a ->{g} a) -> a ->{g, Stream a} () (+2 metadata)
 metadata.authors.jamessully          : Author
 metadata.copyrightHolders.jamessully : CopyrightHolder
 metadata.licenses.jamessully         : License
 Abort.toDefault                      : a -> '{g, Abort} a -> '{g} a (+2 metadata)
 Abort.toDefault!                     : a -> '{g, Abort} a ->{g} a (+2 metadata)
 Abort.toOptional!                    : '{g, Abort} a ->{g} Optional a (+4 metadata)
 Store.unfold                         : s -> '{g, Abort, Store s} r -> '{g} [r] (+3 metadata)
 Store.unfold!                        : s -> '{g, Abort, Store s} r ->{g} [r] (+4 metadata)

 patch Store.patch (added 2 updates)

Removed definitions:

 Abort.toOptional.handler : Request {Abort} a -> Optional a

Update a number of out-of-date docs

This updates a few terms in base that were referencing hashes for which there exist no names in base. Looks like these were artifacts of an update that didn't propagate to docs for some reason.

The changes summarized below are available for you to review, using the following command:

pull-request.load https://github.com/unisonweb/base:.trunk [email protected]:runarorama/bv2:.missingNamesAug11

Updates:

 List.splitAt : Nat -> [a] -> ([a], [a])
 -  #p28531jkth : builtin.Doc
 +  splitAt.doc : builtin.Doc

 Random.boolean.doc : base.Doc
 ↓
 Random.boolean.doc : base.Doc
 +  unisoncomputing2021 : License
 +  pchiusano           : Author

 Random.doc : base.Doc
 ↓
 Random.doc : base.Doc
 +  unisoncomputing2021 : License
 +  pchiusano           : Author
 +  runarorama          : Author

 Random.lcg.doc : base.Doc
 ↓
 Random.lcg.doc : base.Doc
 +  unisoncomputing2021 : License
 +  pchiusano           : Author
 +  runarorama          : Author

 Random.natIn.doc : base.Doc
 ↓
 Random.natIn.doc : base.Doc
 +  unisoncomputing2021 : License
 +  pchiusano           : Author
 +  runarorama          : Author

 Random.natIn.tests.ex1 : [Result]
 ↓
 Random.natIn.tests.ex1 : [Result]
 +  unisoncomputing2021 : License
 +  pchiusano           : Author
 +  isTest              : IsTest
 +  runarorama          : Author

 Random.split.doc : base.Doc
 ↓
 Random.split.doc : base.Doc
 +  unisoncomputing2021 : License
 +  pchiusano           : Author
 +  runarorama          : Author

 Random.splitmix.doc : base.Doc
 ↓
 Random.splitmix.doc : base.Doc
 +  unisoncomputing2021 : License
 +  pchiusano           : Author
 +  runarorama          : Author

There were 4 auto-propagated updates.

 patch patch (added 9 updates)

Adding Exception functionality

Adds helpful Exception functions.

Code review

The changes summarized below are available for you to review, using the following command:
  
    pull-request.load https://github.com/unisonweb/base_v2:.trunk https://github.com/rlmark/my-unison-repo1:.myBase
  
  Updates:

     unique type Exception.Generic (+2 metadata)
     Exception.Generic.failure             : Text -> a -> Failure (+2 metadata)
     Exception.bracket                     : '{g, Exception} r
                                           -> (r ->{g, Exception} ())
                                           -> (r ->{g, Exception} a)
                                           ->{g, Exception} a (+2 metadata)
     Exception.bracket.doc                 : Doc2 (+2 metadata)
     Exception.catch                       : '{g, Exception} a ->{g} Either Failure a (+2 metadata)
     Exception.catch.doc                   : Doc2 (+2 metadata)
     Exception.catchMany                   : [Type]
                                           -> '{g, Exception} a
                                           ->{g, Exception} Either Failure a (+2 metadata)
     Exception.catchMany.doc               : Doc2 (+2 metadata)
     Exception.catchOnly                   : Type
                                           -> '{g, Exception} a
                                           ->{g, Exception} Either Failure a (+2 metadata)
     Exception.catchOnly.doc               : Doc2 (+2 metadata)
     Exception.finally                     : '{g, Exception} ()
                                           -> '{g, Exception} a
                                           ->{g, Exception} a (+2 metadata)
     Exception.finally.doc                 : Doc2 (+2 metadata)
     Exception.reraise.doc                 : Doc2 (+2 metadata)
     metadata.authors.rlmark               : Author
     metadata.authors.rlmark.guid          : GUID
     metadata.licenses.unisoncomputing2021 : License

Point to current base methods in Bag.convolve.tests.natural

Summary

The current Bag.convolve.tests.natural implementation refers to some terms that are no longer in base, and therefore just so hashes on Unison share. This also can prevent people from deleting old versions of base that they might have previously pulled.

Before

Bag.convolve.tests.natural =
  use gen boolean
  #rsk9km80mn
    100 ('let
      bx = !(#eikfnlp21q boolean)
      by = !(#eikfnlp21q boolean)
      f = !yesNo
      g = !yesNo
      o = !logic
      left = #plft6n9tqf (x y -> o (f x) (g y)) bx by
      right = #plft6n9tqf o (#dvrrafvt1b f bx) (#dvrrafvt1b g by)
      #pi4saqo9sp (#9cu0p9v21l left right))

After

  Bag.convolve.tests.natural : [Test.Result]
  Bag.convolve.tests.natural =
    use Bag ==
    use gen boolean
    test.runs
      100 ('let
        bx = !(bagOf boolean)
        by = !(bagOf boolean)
        f = !yesNo
        g = !yesNo
        o = !logic
        left = convolve (x y -> o (f x) (g y)) bx by
        right =
          use Bag map
          convolve o (map f bx) (map g by)
        test.expect (left == right))

Code review

The changes summarized below are available for you to review, using the following command:

pull-request.load [email protected]:unisonweb/base:.trunk [email protected]:ceedubs/unison-dev:.pr.base.nomoreoldstuff

Updates:

 Bag.convolve.tests.natural : [Test.Result]
 ↓
 Bag.convolve.tests.natural : [Test.Result]
 +  unisoncomputing2021 : License
 +  unisoncomputing2020 : License
 +  authors.ceedubs     : Author
 +  isTest              : IsTest
 +  runarorama          : Author

 patch patch (added 1 updates)

Exception.bracket and finally don't necessarily run end/close

It's pretty easy to create a call to Exception.bracket (and similarly Exception.finally) in which the end/close callback is never actually called. This makes it prone to resource leaks.

I don't think that it's possible to implement a safe version of these functions with their current type signatures. They currently allow any g ability in the provided functions, but one of these abilities could result in early termination.

If you run testBracket with the following example, you'll never see closing file handle printed.

testBracket : '{.base.IO, .base.Exception} ()
testBracket _ =
  open : () -> {.base.IO, .base.Exception, .base.Abort} Text
  open _ =
    .base.io.printLine "opening file handle"
    "pretend I'm a file handle"
  close : Text -> {.base.IO, .base.Exception, .base.Abort} ()
  close filehandle =
    .base.io.printLine "closing file handle"
  useFileHandle : Text -> {.base.IO, .base.Exception, .base.Abort} ()
  useFileHandle fileHandle =
      .base.io.printLine ("begin useFileHandle")
      abort
      .base.io.printLine ("end useFileHandle")
  go _ = Exception.bracket open close useFileHandle
  !(.base.Abort.toOptional go)
  ()

Adding functions and docs to `Optional`

Before submitting a pull request, please doublecheck that you have included

  • a clear PR description (don't bother to include issues numbers).
  • Docs linked for types and terms as needed
  • Author and License metadata linked
  • Tests, where appropriate

Code review

pull-request.load https://github.com/unisonweb/base:.trunk.Optional https://github.com/rlmark/my-unison-work:.prs.base._addingOptionalFunctions.Optional

Added definitions:

 None                  : Optional a
 Some                  : a -> Optional a
 ┌ Optional.toList.doc : Doc (+2 metadata)
 └ toList.doc          : Doc (+2 metadata)
 contains              : a -> Optional a -> Boolean (+2 metadata)
 contains.doc          : Doc (+2 metadata)
 exists                : (a ->{g} Boolean) -> Optional a ->{g} Boolean (+2 metadata)
 exists.doc            : Doc (+2 metadata)
 filter                : (a ->{g} Boolean) -> Optional a ->{g} Optional a (+2 metadata)
 filter.doc            : Doc (+2 metadata)
 flatMap               : (a ->{𝕖} Optional b) -> Optional a ->{𝕖} Optional b
 fold                  : '{g} b -> (a ->{g} b) -> Optional a ->{g} b (+2 metadata)
 fold.doc              : Doc (+2 metadata)
 forAll                : (a ->{g} Boolean) -> Optional a ->{g} Boolean (+2 metadata)
 forAll.doc            : Doc (+2 metadata)
 getOrElse             : a -> Optional a -> a (+2 metadata)
 getOrElse.doc         : Doc (+2 metadata)
 isNone                : Optional a -> Boolean (+3 metadata)
 isNone.doc            : Deprecated (+3 metadata)
 isSome                : Optional a -> Boolean (+3 metadata)
 isSome.doc            : Deprecated (+2 metadata)
 map                   : (a ->{𝕖} b) -> Optional a ->{𝕖} Optional b
 map2                  : (a ->{𝕖} b ->{𝕖} c) -> Optional a -> Optional b ->{𝕖} Optional c
 mapOptional           : (a ->{g} Optional b) -> [a] ->{g} [b] (+2 metadata)
 mapOptional.doc       : Doc (+2 metadata)
 orDefault             : a -> Optional a -> a
 orDefault.doc         : Doc (+2 metadata)
 orElse                : Optional a -> Optional a -> Optional a
 toAbort               : Optional a ->{Abort} a (+2 metadata)
 toList                : Optional a -> [a] (+2 metadata)
 unzip                 : Optional (a, b) -> (Optional a, Optional b) (+2 metadata)
 unzip.doc             : Doc (+2 metadata)
 zip                   : Optional a -> Optional b -> Optional (a, b) (+2 metadata)
 zip.doc               : Doc (+2 metadata)

 patch patch (added 86 updates)

Default patch should be cleaned up

I think we could have a UCM command for this, but the RHS of all patch entries should correspond to a named entity in the current namespace. Maybe we should even just automatically enforce this when patches are built up?

I'm guessing this was just some local churn that got accidentally folded into the main patch.

You can view #07s0393c3l to view any of these.

.trunk> view.patch patch

  Edited Types:
    #7di5ureqgi -> Map
    #9me9gsov19 -> Set
    #fjhnoa53kd -> test.Test
    #ps42cgn378 -> Trie
  
  Edited Terms:
    ##List.empty -> List.empty
    #0068krj70r  -> #m0a40f72pk
    #022jdukqcf  -> #3n2r8cr2ep
    #07s0393c3l  -> #lsj6oi101t
    #0gkfsmtdsk  -> Map.map
    #0h74lco9kr  -> Trie.empty
    #12em6b2ruk  -> List.flatMap
    #1j5rcp12qu  -> #cb5hm891se
    #1jsmkvv52o  -> #u0ff7c62oc
    #1ntnt7sdqo  -> #43nf42j1di
    #1pmuqdd0eh  -> #0qr163ptt7
    #1prm9054vg  -> #hv1ibla3lj
    #1v5cidh1g7  -> #o3iaaevjd3
    #2gm9n4850v  -> #9a2vcbl1ug
    #2jk4m34efv  -> compose2
    #2nvflvkffm  -> compose3
    #2qt304rpac  -> #ilghe261jj
    #2rcd6q28m3  -> #cb6pj4nb4t
    #2rup2odgkv  -> #fh5pojbs6a
    #3ltku227r4  -> Trie.head
    #3robupp9ra  -> test.internals.v1.Test.Report.empty
    #3uumolunsc  -> #hvqlqc0ug1
    #416cekf5a9  -> #ivlp37of29
    #41nckqsvpe  -> #809ifnph80
    #4a6tb28scv  -> Set.toList
    #4aktnuklc9  -> #rle758fa77
    #4brdkq13kr  -> Trie.gen
    #4dsb3hm5bh  -> Trie.union.tests.values
    #4kimtmtr1e  -> #4erqcusc21
    #4lm6ab9e0n  -> #tcs4j0a6s2
    #4nkiocr4ql  -> #n631pci10h
    #50jtro367a  -> #ht0a5u8bfu
    #575g5m259o  -> #b1fa2cm5eg
    #5dcbdmdnn1  -> #6r52cqv00s
    #5fu9v9bfkk  -> #3cisllo8j8
    #5l64s5pgu6  -> #m3pkhs3bvq
    #5qkqt9tcvi  -> #hpg2rql9u1
    #60g5t4trs5  -> #jt73l48m71
    #61jvl77e4l  -> #sicp77o5ss
    #66sfrf8pcd  -> #c1v545tvsq
    #6a4d4ig50q  -> #l5sutcle78
    #6eii6cbrst  -> #ft749c2ubu
    #6f2459deij  -> #q9bnnoaev1
    #6lsv1mouk7  -> #uakt86grgl
    #6mv80jcdin  -> #87f14cokiu
    #6pfu97mcji  -> #him44leedf
    #73llk3d8go  -> #80tua33dm0
    #74a427h4gr  -> #me9rtg421b
    #74k2cq7jl2  -> Map.insert
    #7ceup2jb3q  -> #akopbl247q
    #7q3ad89881  -> #ffjibsedkq
    #7rlku6qr87  -> Map.keys
    #7t8atr8n4r  -> Trie.tail
    #7u682a6ja2  -> #4ifp1tiho8
    #7v3kh0h682  -> #8dq3j8n3o1
    #87tqm7scqn  -> #ije7ak8q0r
    #8c0sc4dla1  -> #30fsij172t
    #8ctc0q6loa  -> #rivfsa4c3c
    #8dmqrnv8iq  -> io.delay.doc
    #8n09pcqmc3  -> #9d7gvqnmbd
    #8n80sl8gig  -> #s77a0bcv7n
    #8tr22ck98r  -> #onb0hric3r
    #91k9j1d147  -> #2j8e90o7k1
    #9accsvjbeq  -> #ebhr6f859h
    #9dpaiopmlv  -> Set.size
    #9f0ppphej1  -> #b0ho92bt0h
    #9hbi4e9bkl  -> #kfki99ou35
    #9or314vgep  -> #tsuhimjhua
    #a6gosr6bn5  -> #jj6l71en1o
    #aa0pf9eunn  -> Set.underlying
    #acb5ql6ubl  -> #347fvpimpu
    #aj9c6m4aqd  -> #cns20tpqnk
    #am0dcvijbh  -> #72bkvmppnl
    #armrso2i4l  -> #brumidauaj
    #au5e91vk3o  -> #aqjo8tg2fc
    #ausqmo0vrt  -> Map.toList
    #bclf693390  -> #7al3dmi92g
    #bivcubo21g  -> Set.contains
    #bkhovok4u7  -> Set.toMap
    #bnp5gitfns  -> Either.fold
    #c3c6majmib  -> #4kvc33jiqn
    #c3iale4cr8  -> Trie.map
    #c6l8ln1srl  -> #5hgtbfr720
    #c8fro0seo3  -> #m9rf28fajm
    #cc5ivc3es9  -> #mblog9jmcu
    #cctv7bmle8  -> #tjq4611c9t
    #cf8sji8ng2  -> Trie.head.set
    #cqc2ip17mm  -> Universal.min
    #csvdkjd6c6  -> #9e8nquna7l
    #cvv8n7vc9i  -> #gpnflvsbfl
    #d7o8km67c4  -> #p0fp3hual7
    #dfaaimsoor  -> #1d9utb6qph
    #djn0e1qitn  -> Set.empty
    #do0af4msvj  -> #fjqierkstn
    #dqlkpq2n0r  -> #1rv3h8tqp6
    #e047k63mmd  -> #iau9gubjnd
    #e4cjqdjsfj  -> #oj4k1tf6vn
    #e52h15ar8a  -> #pdnfckvuft
    #e8qq2p5oj3  -> #h82mheuf2i
    #e9thu54uv3  -> #fm6m3bo7uv
    #ea640gt6ha  -> #8f5v2ibmck
    #ea65junq51  -> Map.contains
    #ed6gk6p8h9  -> #pi9onlsn0l
    #eirnjrmln0  -> #8eoocdihh4
    #em9rot4c0r  -> #fj3eorif38
    #eu29av7p4c  -> Map.singleton
    #f3lpn74ft5  -> #91ggkmdjbu
    #f79j2mv7h9  -> #ejlu8ljcj3
    #f82a52c6te  -> #f3ogodn4ds
    #fauuedr3m9  -> #jo3jtd54di
    #fh939usji8  -> test.internals.v1.foldReport
    #fsnc0pme33  -> #98f0c83c5l
    #g1j9ts6meq  -> #ot593vm5id
    #ggrgo97pr6  -> #f1a4t2pngp
    #gj6ocbnefp  -> #k744t8sgo3
    #gm675le4vh  -> #virntc4i7j
    #gmregklgad  -> Trie.tail.modify
    #gn13vdupub  -> Map.empty
    #gnbtc0teop  -> #hg42537to5
    #got11t4k7q  -> #d2nj9o0n31
    #gtmc5iqp6s  -> #9k85jkgfmg
    #ho75g1fqrb  -> #6h022a3441
    #htdgg5ndng  -> #g1sann7gh8
    #i69om2kh1o  -> #l8angmm9b8
    #ii7olum148  -> test.internals.v1.Test.Report.toCLIResult
    #iiqjnagadg  -> #05niktk87d
    #im87revsbi  -> #861i9dgclv
    #iqkuul19to  -> #r4lhgbgqtg
    #iql8rja431  -> #pecb36bjjc
    #iqvk4ormu8  -> #bu6l1q88rv
    #j123g8serp  -> Trie.head.modify
    #j2gievqbiv  -> test.internals.v1.Test.modifyStatus
    #j514dideqr  -> Map.get
    #jedvolreqr  -> #q574cuh1os
    #jfubcttdlv  -> #h8ss3o3dp1
    #jkcnpom3od  -> #haqkl7669h
    #jmpc6j3n0q  -> #pvfmeah2kd
    #jpq6pdu6e5  -> #3mil8v8r57
    #jrg62tjojp  -> #r73pfr0sq9
    #jujogr1qks  -> #eqspf6ogkj
    #kc7uhqicms  -> #i3mu2hjt9b
    #kurc15mpm3  -> #0am93l3ekt
    #l11qiubfq5  -> #4k7rbkupdo
    #l6dmo8v0nc  -> #sdh4lko5f6
    #l7ler9rv5p  -> test.internals.v1.Test.modifyScope
    #ldv7kv8hoj  -> #t2lrb10i70
    #lgs63tr7sq  -> #6kgb36lp03
    #lnl9kpjh1u  -> #rsk9km80mn
    #lobj0btg6a  -> #q0fr8cf07n
    #lq233nbkn2  -> #kjhup5kghg
    #lsfrcr8jqt  -> #g8f8moci59
    #ltk1l4ag6i  -> #jqesrrcrnf
    #m725bnv0i7  -> #lldf9hvhqa
    #maj469np6f  -> #s2uorqet3k
    #me5ped0rlh  -> #fk7gag18dg
    #mnb4bi1vuv  -> #ugdnqoken6
    #mo3sn64t3a  -> test.internals.v1.Test.report
    #n97mb0il3f  -> #mdnu9vn3kh
    #nbfiu1lof4  -> #svl61f4upd
    #necc7deph2  -> Universal.max
    #nfu6qd6gjf  -> #ns68scb666
    #npsba0e8v3  -> #gfui1binp3
    #nsjfm3466e  -> #0kgriirhkg
    #nsn57r90ca  -> #mv474fn36q
    #ntomm08vd2  -> #dcb4ajgkgr
    #o3ub8lveh4  -> Trie.values
    #o66re3hkcc  -> #9ppgfb6so7
    #o7md87alj6  -> #mmbdj6adaa
    #oc8gs1ep2o  -> #d4fba904ag
    #ocsplh6ccd  -> Map.internal.maxViewSure
    #odiadu42jc  -> #38l0i3rv04
    #ol371ph3n8  -> Set.foldRight
    #otv9rnr9tq  -> #l47uhg4vva
    #p9b8hlahkv  -> Set.foldLeft
    #ptf65b6dcb  -> #o1q3t6l5sa
    #qhpcvq36sc  -> #7h5ljub0c0
    #qibhvvh4sr  -> #dqam0baoos
    #ql10ovl5bi  -> #ee54lcue9t
    #ra7lvborbq  -> #otoq48kfei
    #rg2easj09q  -> #f77gl83j3p
    #rgpifgtj1i  -> #8v3tabfose
    #riugi1fv6o  -> test.label
    #rocouvpqbi  -> #bl1qgckq1e
    #rt538602g2  -> #f17s8r9n4u
    #s4q5kvfd99  -> #0f275d03vm
    #s7cie812ap  -> Universal.max
    #seve45rddi  -> Map.size
    #sf9hngt074  -> Universal.min
    #skd38u0nns  -> #6bt6i2dirq
    #sp7f0nfhpa  -> #cvgc488k9o
    #st44ikphvk  -> #73ig6p4b61
    #t6tjrivevh  -> Set.insert
    #t9p6gt572c  -> #gi0fi0uc48
    #tasn3cqeov  -> #50erp6nq26
    #tidndnn1ta  -> Map.values
    #tjf7avgbfb  -> #gplqn45p9g
    #tnmktn3tk2  -> #tnsskheisv
    #tsh9ra3m9d  -> #4jibl9jjuu
    #tudj7fjk62  -> #qmf3a6fjdi
    #u7447mknrh  -> #qq47gdap00
    #ua1omd4r2g  -> #v9nih661nv
    #uhjuimqmks  -> #pmo0tibe28
    #uj7qm6q3g4  -> Trie.lookup
    #uquqoe3erh  -> #jdaakfbkuc
    #v2o6cqvabk  -> #t7ccksqj07
    #v61bnbitho  -> #bv763222sh
    #vc5fd7p9lp  -> #g38b337a7a
    #vgja5u0lkn  -> Map.internal.link
    #vkj33km74f  -> #c6l1f1g1ei
    #vv0c750jef  -> Trie.tail.set
  
  Tip: To remove entries from a patch, use delete.term-replacement or delete.type-replacement, as
       appropriate.

Rename `.` compose from base.

Before submitting a pull request, please doublecheck that you have included

  • Docs linked for types and terms as needed
  • Author and License metadata linked
  • Tests, where appropriate (only one valid implementation for this type, no tests required.

Code review

The changes summarized below are available for you to review, using the following command:

pull-request.load https://github.com/unisonweb/base:.trunk https://github.com/ChrisPenner/unison-codebase:.prs.base._compose

Added definitions:

 <<     : (b ->{𝕖} c) -> (a ->{𝕖} b) -> a ->{𝕖} c
 >>     : (a ->{𝕖} b) -> (b ->{𝕖} t) -> a ->{𝕖} t
 <<.doc : Doc
 >>.doc : Doc

Name changes:

Original    Changes
 .       ┐   . (removed)
 compose ┘

Add aliases for new compression builtins

.trunk> alias.term ##Bytes.gzip.compress Bytes.gzip.compress
.trunk> alias.term ##Bytes.gzip.decompress Bytes.gzip.decompress
.trunk> alias.term ##Bytes.zlib.compress Bytes.zlib.compress
.trunk> alias.term ##Bytes.zlib.decompress Bytes.zlib.decompress

Add base.Text.join for joining lists of Text with a separator

Overview

Add a simple join function to take a list of Text and a separator and join the list on that separate.

Text.join ", " ["Hello", "World"] -- "Hello, World"

Code review

The changes summarized below are available for you to review, using the following command:

pull-request.load https://github.com/unisonweb/base:.trunk https://github.com/hojberg/unison-base:._prs.base

Added definitions:

 Text.join           : Text -> [Text] -> Text (+2 metadata)
 Text.join.doc       : Doc (+2 metadata)
 Text.join.tests.ex1 : [Result] (+3 metadata)

Adding List, Char, and Text utilities post-dogfooding

@hojberg, @pchiusano and I added a few functions to base.

Also, apologies if I have massively messed up the PR process once again. 🤞

Controversial Decisions:

  • Text.trim walks the string twice. We can write a more efficient but less concise function if need be.
  • We weren't sure what findMap should be called.
  • Char.isWhitespace defines whitespace as \s \t \n and \r - but maybe things like "form-feed" should also be considered whitespace? We weren't sure.

Code review

The changes summarized below are available for you to review, using the following command:

pull-request.load https://github.com/unisonweb/base:.trunk https://github.com/rlmark/my-unison-repo3:.basePr

Added definitions:

 List.dropLastWhile.tests.all  : [Result] (+4 metadata)
 Text.trim.tests.all           : [Result] (+5 metadata)
 List.dropLastWhile.doc        : base.Doc (+3 metadata)
 Text.dropLastWhile.doc        : base.Doc (+3 metadata)
 Text.dropWhile.doc            : base.Doc (+3 metadata)
 List.findMap.doc              : base.Doc (+3 metadata)
 Either.isLeft.doc             : base.Doc (+3 metadata)
 Either.isRight.doc            : base.Doc (+3 metadata)
 Char.isWhitespace.doc         : base.Doc (+2 metadata)
 List.dropLastWhile            : (a ->{g} Boolean) -> [a] ->{g} [a] (+3 metadata)
 Text.dropLastWhile            : (Char ->{g} Boolean) -> Text ->{g} Text (+3 metadata)
 Text.dropWhile                : (Char ->{g} Boolean) -> Text ->{g} Text (+3 metadata)
 Text.trim.tests.edges         : [Result] (+5 metadata)
 List.findMap.tests.ex1        : [Result] (+4 metadata)
 List.findMap.tests.ex2        : [Result] (+3 metadata)
 List.findMap                  : (a ->{g} Optional b) -> [a] ->{g} Optional b (+3 metadata)
 Either.isLeft                 : Either a b -> Boolean (+3 metadata)
 Either.isRight                : Either a b -> Boolean (+3 metadata)
 Char.isWhitespace             : Char -> Boolean (+3 metadata)
 List.dropLastWhile.tests.last : [Result] (+4 metadata)
 List.dropLastWhile.tests.none : [Result] (+3 metadata)
 Text.trim.tests.none          : [Result] (+5 metadata)
 Text.trim                     : Text -> Text (+3 metadata)

couldn't delete an M1 base because `_latest` depends on it

@hojberg ran into this on dog-fooding day.

This works:

.> pull https://github.com/unisonweb/base:.releases._M1m M1m
.> delete.namespace M1m

But this fails, because the .releases._M2* namespaces are not self-contained; they're missing names for some types used by the constructors of IO.Deprecated.

.> pull https://github.com/unisonweb/base:.releases._M2g M2g
.> pull https://github.com/unisonweb/base:.releases._M1m M1m
.> delete.namespace M1m

.trunk is ok in this case, though; it includes names for them, like io.deprecated.Error.Deprecated

Add List.find, List.deleteFirst

Add functions for finding an item in a list by predicate, and for deleting a single item from a list by predicate. Paul asked specifically for find, I'm happy to bikeshed or remove deleteFirst if y'all prefer.


Before submitting a pull request, please doublecheck that you have included

  • a clear PR description (don't bother to include issues numbers).
  • Docs linked for types and terms as needed
  • Author and License metadata linked
  • Tests, where appropriate

Code review

The changes summarized below are available for you to review, using the following command:

pull-request.load https://github.com/unisonweb/base:.trunk https://github.com/sullyj3/myUnisonCodebase:.prs.base.listFind

Added definitions:

 List.deleteFirst                     : (a ->{g} Boolean) -> [a] ->{g} [a] (+2 metadata)
 List.deleteFirst.doc                 : Doc (+2 metadata)
 List.find.doc                        : Doc (+2 metadata)
 List.find!.doc                       : Doc (+2 metadata)
 List.deleteFirst.tests.ex1           : [Result] (+4 metadata)
 List.find.tests.ex1                  : [Result] (+3 metadata)
 List.deleteFirst.tests.ex2           : [Result] (+4 metadata)
 List.find.tests.ex2                  : [Result] (+3 metadata)
 List.deleteFirst.tests.ex3           : [Result] (+4 metadata)
 List.find                            : (a ->{g} Boolean) -> [a] ->{g} Optional a (+2 metadata)
 List.find!                           : (a ->{g} Boolean) -> [a] ->{g, Abort} a (+2 metadata)
 metadata.authors.jamessully.guid     : GUID
 metadata.authors.jamessully          : Author
 metadata.copyrightHolders.jamessully : CopyrightHolder
 metadata.licenses.jamessully         : License

Request: MurmurHash2 implementation

Here's a Haskell implementation https://hackage.haskell.org/package/murmur-hash-0.1.0.9/docs/src/Data-Digest-Murmur64.html#hash64AddWord64

This came up in #12 where we could use a hashing function that works on Nat. I think it'll be useful for other stuff too.

Here's a minimal proposed API:

MurmurHash.Readme = {{ Some docs, also I'd credit the Haskell code if taking inspiration from it. }}

-- addNat hashState n -> hashState'
MurmurHash.addNat : Nat -> Nat -> Nat
-- finish : hashState -> hash
MurmurHash.finish : Nat -> Nat

This can use the new documentation format.

Concurrent queue implementation

Pretty standard STM-based concurrent mutable queue implementation.

The changes summarized below are available for you to review, using the following command:

pull-request.load https://github.com/unisonweb/base:.trunk.io.STM https://github.com/pchiusano/unisoncode:.prs.tq

Added definitions:

 unique type TQueue a (+2 metadata)
 TQueue.TQueue                   : TVar [a] -> TVar Nat -> TQueue a
 docs.glossary.FIFO              : Doc (+2 metadata)
 TQueue.boundedEnqueue           : Nat -> a -> TQueue a ->{STM} () (+2 metadata)
 docs.glossary.FIFO.content      : Doc (+2 metadata)
 TQueue.dequeue                  : TQueue a ->{STM} a (+2 metadata)
 TQueue.dequeueNonce             : TQueue a ->{STM} Nat (+2 metadata)
 TQueue.doc                      : Doc (+2 metadata)
 TQueue.boundedEnqueue.doc       : Doc (+2 metadata)
 TQueue.dequeue.doc              : Doc (+2 metadata)
 TQueue.dequeueNonce.doc         : Doc (+2 metadata)
 TQueue.elements.doc             : Doc (+2 metadata)
 TQueue.empty.doc                : Doc (+2 metadata)
 TQueue.enqueue.doc              : Doc (+2 metadata)
 TQueue.enqueueAll.doc           : Doc (+2 metadata)
 TQueue.fromList.doc             : Doc (+2 metadata)
 TQueue.peek.doc                 : Doc (+2 metadata)
 TQueue.pushback.doc             : Doc (+2 metadata)
 TQueue.size.doc                 : Doc (+2 metadata)
 TQueue.tryBoundedEnqueue.doc    : Doc (+2 metadata)
 TQueue.tryBoundedEnqueueAll.doc : Doc (+2 metadata)
 TQueue.tryPeek.doc              : Doc (+2 metadata)
 TQueue.elements                 : TQueue a ->{STM} [a] (+2 metadata)
 TQueue.empty                    : '{STM} TQueue a (+2 metadata)
 TQueue.enqueue                  : a -> TQueue a ->{STM} () (+2 metadata)
 TQueue.enqueueAll               : [a] -> TQueue a ->{STM} () (+2 metadata)
 TQueue.fromList                 : [a] ->{STM} TQueue a (+2 metadata)
 TQueue.peek                     : TQueue a ->{STM} a (+2 metadata)
 TQueue.pushback                 : a -> TQueue a ->{STM} () (+2 metadata)
 TQueue.size                     : TQueue a ->{STM} Nat (+2 metadata)
 TQueue.tryBoundedEnqueue        : Nat -> a -> TQueue a ->{STM} Boolean (+2 metadata)
 TQueue.tryBoundedEnqueueAll     : Nat -> [a] -> TQueue a ->{STM} Boolean (+2 metadata)
 TQueue.tryDequeue               : TQueue a ->{STM} Optional a (+2 metadata)
 TQueue.tryPeek                  : TQueue a ->{STM} Optional a (+2 metadata)

Generalize type of Stream.flatMap

Code review

Stream.flatMap should allow changing the type of the emitted values; flatMap! has the correct type, but flatMap didn't.

P.s. I think I might not have gotten the metadata & licenses quite right; if there are some commands I can run to fix the patch please let me know.

  The changes summarized below are available for you to review, using the following command:

    pull-request.load https://github.com/unisonweb/base:.trunk https://github.com/ChrisPenner/unison-codebase:.prs.base._flatMapFix

  Updates:

     Stream.flatMap : (a ->{e, Stream a} r) -> '{e, Stream a} r -> '{e, Stream a} r
     ↓
     Stream.flatMap : (a ->{e, Stream b} r) -> '{e, Stream a} r -> '{e, Stream b} r
     +  anovstrup.mit_2020                        : License
     +  authors.anovstrup                         : Author
     +  _base.metadata.authors.chrispenner        : Author
     +  _flatMapFix.metadata.licenses.chrispenner : License
     +  _flatMapFix.metadata.authors.chrispenner  : Author

    There were 1 auto-propagated updates.

     patch patch (added 1 updates)

  Added definitions:

     metadata.authors.chrispenner          : Author
     metadata.authors.chrispenner.guid     : GUID
     metadata.copyrightHolders.chrispenner : CopyrightHolder
     metadata.licenses.chrispenner         : License (+1 metadata)

Replace `docEval` and `docEvalInline` to require that functions be pure

This is the change to base to go with unisonweb/unison#2238. It tweaks the signature of docEval and docEvalInline to disallow abilities.

The signature actually looks the same in the diff due to this bug unisonweb/unison#2242

I went ahead and added those entries to the default patch. So doing todo on trunk will show you docs that depend on the old version of docEval and docEvalInline. I spotted a few docs that couldn't typecheck with the new signature this way.

Code review

The changes summarized below are available for you to review, using the following command:

pull-request.load https://github.com/unisonweb/base:.trunk https://github.com/pchiusano/unisoncode:.prs._docEval

Updates:

 Exception.catchMany.doc : Doc2
 ↓
 Exception.catchMany.doc : Doc2
 +  unisoncomputing2021 : License
 +  pchiusano           : Author
 +  rlmark              : Author

 Exception.catchOnly.doc : Doc2
 ↓
 Exception.catchOnly.doc : Doc2
 +  unisoncomputing2021 : License
 +  pchiusano           : Author
 +  rlmark              : Author

 Exception.finally.doc : Doc2
 ↓
 Exception.finally.doc : Doc2
 +  unisoncomputing2021 : License
 +  pchiusano           : Author
 +  rlmark              : Author

 List.docs.traversing : Doc2
 ↓
 List.docs.traversing : Doc2
 +  unisoncomputing2021 : License
 +  pchiusano           : Author
 +  runarorama          : Author

 List.initialize : Nat -> (Nat ->{e} a) ->{e} [a]
 -  _base.List.initialize.doc    : Doc2
 +  _docEval.List.initialize.doc : Doc2

 Universal.compareOn : (a ->{e} x) -> a -> a ->{e} Ordering
 -  _base.Universal.compareOn.doc    : Doc2
 +  _docEval.Universal.compareOn.doc : Doc2

 Universal.ordering : a -> a -> Ordering
 -  _base.Universal.ordering.doc    : Doc2
 +  _docEval.Universal.ordering.doc : Doc2

 syntax.docEval : 't -> Doc2
 ↓
 syntax.docEval : 'a -> Doc2

 syntax.docEvalInline : 't -> Doc2
 ↓
 syntax.docEvalInline : 'a -> Doc2

There were 46 auto-propagated updates.

 patch patch (added 2 updates)

Stream functions

The changes summarized below are available for you to review, using the following command:

pull-request.load https://github.com/unisonweb/base:.trunk https://github.com/anovstrup/unison-all:.prs.base._stream.v3

Updates:

 Stream.range : Nat -> Nat ->{Stream Nat} ()
 ↓
 Stream.range : Nat -> Nat -> '{Stream Nat} ()
 +  anovstrup.mit_2020  : License
 +  unisoncomputing2020 : License
 +  pchiusano           : Author
 +  authors.anovstrup   : Author

 Stream.toList : '{e, Stream a} () ->{e} [a]
 ↓
 Stream.toList : '{g, Stream a} r -> '{g} [a]
 -  unisoncomputing2020 : License
 -  pchiusano           : Author
 +  anovstrup.mit_2020  : License
 +  authors.anovstrup   : Author

There were 1 auto-propagated updates.

 patch patch (added 1 updates)

Added definitions:

 Stream.++                        : (v1 ->{g, Stream a} v2)
                                  -> (v2 ->{g, Stream a} v3)
                                  -> v1
                                  ->{g, Stream a} v3 (+2 metadata)
 Stream.++.doc                    : _M2.Doc (+2 metadata)
 Stream.+:                        : a -> '{Stream a} r -> '{Stream a} r (+2 metadata)
 Stream.+:.doc                    : _M2.Doc (+2 metadata)
 Stream.Int.all                   : '{Stream Int} a (+2 metadata)
 Stream.Int.all.doc               : _M2.Doc (+2 metadata)
 Stream.Int.from                  : Int -> '{Stream Int} a (+2 metadata)
 Stream.Int.from!                 : Int ->{Stream Int} a (+2 metadata)
 Stream.Int.from!.doc             : _M2.Doc (+2 metadata)
 Stream.Int.from.doc              : _M2.Doc (+2 metadata)
 Stream.Int.negatives             : '{Stream Int} a (+2 metadata)
 Stream.Int.negatives.doc         : _M2.Doc (+2 metadata)
 Stream.Int.positives             : '{Stream Int} a (+2 metadata)
 Stream.Int.positives.doc         : _M2.Doc (+2 metadata)
 Stream.Int.range                 : Int -> Int -> '{Stream Int} () (+2 metadata)
 Stream.Int.range!                : Int ->{Stream Int} Int ->{Stream Int} () (+2 metadata)
 Stream.Int.range!.doc            : _M2.Doc (+2 metadata)
 Stream.Int.range.doc             : _M2.Doc (+2 metadata)
 Stream.Nat.all                   : '{Stream Nat} a (+2 metadata)
 Stream.Nat.all.doc               : _M2.Doc (+2 metadata)
 Stream.drop                      : Nat -> '{g, Stream a} r -> '{g, Stream a} r (+2 metadata)
 Stream.drop!                     : Nat -> '{g, Stream a} r ->{g, Stream a} r (+2 metadata)
 Stream.drop!.doc                 : _M2.Doc (+2 metadata)
 Stream.drop.doc                  : _M2.Doc (+2 metadata)
 Stream.drop.test                 : [Result] (+3 metadata)
 Stream.emitAndReturn             : a -> '{Stream a} a (+2 metadata)
 Stream.emitAndReturn!            : a ->{Stream a} a (+2 metadata)
 Stream.emitAndReturn!.doc        : _M2.Doc (+2 metadata)
 Stream.emitAndReturn.doc         : _M2.Doc (+2 metadata)
 Stream.filter                    : (a ->{g} Boolean)
                                  -> '{g, Stream a} r
                                  -> '{g, Stream a} r (+2 metadata)
 Stream.filter!                   : (a ->{g} Boolean)
                                  -> '{g, Stream a} r
                                  ->{g, Stream a} r (+2 metadata)
 Stream.filter!.doc               : _M2.Doc (+2 metadata)
 Stream.filter.doc                : _M2.Doc (+2 metadata)
 Stream.filter.test               : [Result] (+3 metadata)
 Stream.flatMap                   : (a ->{e, Stream a} r)
                                  -> '{e, Stream a} r
                                  -> '{e, Stream a} r (+2 metadata)
 Stream.flatMap!                  : (a ->{e, Stream b} r)
                                  -> '{e, Stream a} r
                                  ->{e, Stream b} r (+2 metadata)
 Stream.flatMap!.doc              : _M2.Doc (+2 metadata)
 Stream.flatMap.doc               : _M2.Doc (+2 metadata)
 Stream.flatMap.test              : [Result] (+3 metadata)
 Stream.fold                      : (b ->{g} a ->{g} b)
                                  -> b
                                  -> '{g, Stream a} r
                                  -> '{g} b (+2 metadata)
 Stream.fold!                     : (b ->{g} a ->{g} b)
                                  -> b
                                  -> '{g, Stream a} r
                                  ->{g} b (+2 metadata)
 Stream.fold!.doc                 : _M2.Doc (+2 metadata)
 Stream.fold!.test                : [Result] (+3 metadata)
 Stream.fold.doc                  : _M2.Doc (+2 metadata)
 Stream.foldWithResult            : (b ->{g} a ->{g} b)
                                  -> b
                                  -> '{g, Stream a} r
                                  -> '{g} (b, r) (+2 metadata)
 Stream.foldWithResult!           : (b ->{g} a ->{g} b)
                                  -> b
                                  -> '{g, Stream a} r
                                  ->{g} (b, r) (+2 metadata)
 Stream.foldWithResult!.doc       : _M2.Doc (+2 metadata)
 Stream.foldWithResult!.handler   : (b ->{g} a ->{g} b)
                                  -> b
                                  -> Request (Stream a) r
                                  ->{g} (b, r) (+2 metadata)
 Stream.foldWithResult!.test      : [Result] (+3 metadata)
 Stream.foldWithResult.doc        : _M2.Doc (+2 metadata)
 Stream.from                      : Nat -> '{Stream Nat} a (+2 metadata)
 Stream.from!                     : Nat ->{Stream Nat} a (+2 metadata)
 Stream.from!.doc                 : _M2.Doc (+2 metadata)
 Stream.from.doc                  : _M2.Doc (+2 metadata)
 Stream.fromList                  : [a] -> '{Stream a} () (+2 metadata)
 Stream.fromList!                 : [a] ->{Stream a} () (+2 metadata)
 Stream.fromList!.doc             : _M2.Doc (+2 metadata)
 Stream.fromList.doc              : _M2.Doc (+2 metadata)
 Stream.interleave                : '{g, Stream a} r
                                  -> '{g, Stream a} r
                                  -> '{g, Stream a} r (+2 metadata)
 Stream.interleave!               : '{g, Stream a} r
                                  -> '{g, Stream a} r
                                  ->{g, Stream a} r (+2 metadata)
 Stream.interleave!.doc           : _M2.Doc (+2 metadata)
 Stream.interleave!.handler       : '{e} r
                                  -> Request (Stream a) r
                                  ->{e, Stream a} r (+2 metadata)
 Stream.interleave.doc            : _M2.Doc (+2 metadata)
 Stream.map                       : (a ->{g} b)
                                  -> '{g, Stream a} r
                                  -> '{g, Stream b} r (+2 metadata)
 Stream.map!                      : (a ->{g} b)
                                  -> '{g, Stream a} r
                                  ->{g, Stream b} r (+2 metadata)
 Stream.map!.doc                  : _M2.Doc (+2 metadata)
 Stream.map.doc                   : _M2.Doc (+2 metadata)
 Stream.map.test                  : [Result] (+3 metadata)
 Stream.pipe                      : '{g, Stream a} r
                                  -> '{g, Stream b, Ask a} r
                                  -> '{g, Stream b} r (+2 metadata)
 Stream.pipe!                     : '{g, Stream a} r
                                  -> '{g, Stream b, Ask a} r
                                  ->{g, Stream b} r (+2 metadata)
 Stream.pipe!.doc                 : _M2.Doc (+2 metadata)
 Stream.pipe!.handler             : '{g, Stream a} r
                                  -> Request {Ask a, Stream b} r
                                  ->{g, Stream b} r (+2 metadata)
 Stream.pipe.doc                  : _M2.Doc (+2 metadata)
 Stream.range!.doc                : _M2.Doc (+2 metadata)
 Stream.range.doc                 : _M2.Doc (+2 metadata)
 Stream.range.test.emptyRange     : [Result] (+3 metadata)
 Stream.range.test.emptyRange2    : [Result] (+3 metadata)
 Stream.range.test.listLike       : [Result] (+3 metadata)
 Stream.range.test.singletonRange : [Result] (+3 metadata)
 Stream.rangeClosed               : Nat -> Nat -> '{Stream Nat} () (+2 metadata)
 Stream.rangeClosed!              : Nat -> Nat ->{Stream Nat} () (+2 metadata)
 Stream.rangeClosed!.doc          : _M2.Doc (+2 metadata)
 Stream.rangeClosed.doc           : _M2.Doc (+2 metadata)
 Stream.scan                      : (b ->{g} a ->{g} b)
                                  -> b
                                  -> '{g, Stream a} r
                                  -> '{g, Stream b} r (+2 metadata)
 Stream.scan!                     : (b ->{g} a ->{g} b)
                                  -> b
                                  -> '{g, Stream a} r
                                  ->{g, Stream b} r (+2 metadata)
 Stream.scan!.doc                 : _M2.Doc (+2 metadata)
 Stream.scan.doc                  : _M2.Doc (+2 metadata)
 Stream.take                      : Nat
                                  -> '{g, Stream a} r
                                  -> '{g, Stream a} Optional r (+2 metadata)
 Stream.take!                     : Nat
                                  -> '{g, Stream a} r
                                  ->{g, Stream a} Optional r (+2 metadata)
 Stream.take!.doc                 : _M2.Doc (+2 metadata)
 Stream.take.doc                  : _M2.Doc (+2 metadata)
 Stream.take.testCompletion       : [Result] (+3 metadata)
 Stream.take.testEarlyTermination : [Result] (+3 metadata)
 Stream.terminated                : '{g, Stream a} r
                                  -> '{g, Stream (Optional a)} r (+2 metadata)
 Stream.terminated!               : '{g, Stream a} r ->{g, Stream (Optional a)} r (+2 metadata)
 Stream.terminated!.doc           : _M2.Doc (+2 metadata)
 Stream.terminated.doc            : _M2.Doc (+2 metadata)
 Stream.terminated.test           : [Result] (+3 metadata)
 Stream.to                        : Nat -> '{Stream Nat} () (+2 metadata)
 Stream.to!                       : Nat ->{Stream Nat} () (+2 metadata)
 Stream.to!.doc                   : _M2.Doc (+2 metadata)
 Stream.to.doc                    : _M2.Doc (+2 metadata)
 Stream.toList!                   : '{g, Stream a} r ->{g} [a] (+4 metadata)
 Stream.toList!.doc               : _M2.Doc (+2 metadata)
 Stream.toList.doc                : _M2.Doc (+2 metadata)
 Stream.toList.test.bidirectional : [Result] (+3 metadata)
 Stream.toListWithResult          : '{g, Stream a} r -> '{g} ([a], r) (+2 metadata)
 Stream.toListWithResult!         : '{g, Stream a} r ->{g} ([a], r) (+2 metadata)
 Stream.toListWithResult!.doc     : _M2.Doc (+2 metadata)
 Stream.toListWithResult.doc      : _M2.Doc (+2 metadata)
 Stream.until                     : Nat -> '{Stream Nat} () (+2 metadata)
 Stream.until!                    : Nat ->{Stream Nat} () (+2 metadata)
 Stream.until!.doc                : _M2.Doc (+2 metadata)
 Stream.until.doc                 : _M2.Doc (+2 metadata)
 Stream.zip                       : '{g, Stream a} r
                                  -> '{g, Stream b} r
                                  -> '{g, Stream (a, b)} r (+2 metadata)
 Stream.zip!                      : '{g, Stream a} r
                                  -> '{g, Stream b} r
                                  ->{g, Stream (a, b)} r (+2 metadata)
 Stream.zip!.doc                  : _M2.Doc (+2 metadata)
 Stream.zip.doc                   : _M2.Doc (+2 metadata)
 Stream.zipWith                   : (a ->{g} b ->{g} c)
                                  -> '{g, Stream a} r
                                  -> '{g, Stream b} r
                                  -> '{g, Stream c} r (+2 metadata)
 Stream.zipWith!                  : (a ->{g} b ->{g} c)
                                  -> '{g, Stream a} r
                                  -> '{g, Stream b} r
                                  ->{g, Stream c} r (+2 metadata)
 Stream.zipWith!.doc              : _M2.Doc (+2 metadata)
 Stream.zipWith.doc               : _M2.Doc (+2 metadata)

Name changes:

Original         Changes
 Stream.range     Stream.range! (added)
                  Stream.range (removed)

Older versions of the PR are still available to review using the following commands:

pull-request.load https://github.com/unisonweb/base:.trunk https://github.com/anovstrup/unison-all:.prs.base._stream.v2

pull-request.load https://github.com/unisonweb/base:.trunk https://github.com/anovstrup/unison-all:.prs.base._streamPR

Add arbitrary-precision Natural numbers

This adds the Natural type, operations on that type, and a few supporting operations to Base. This type provides arbitrary-precision arithmetic on positive integers, letting users work with very large numbers as well as paving the way for supporting exact fractions and rational numbers.

Operations here are not nearly as fast as they could be, as the underlying type is a List. Once we have a more suitable data type in Unison, the representation here should be easy to replace.

The changes summarized below are available for you to review, using the following
command:

pull-request.load https://github.com/unisonweb/base:.trunk https://github.com/runarorama/bv2:.arbprecnats

Added definitions:

 unique type Natural (+2 metadata)
 Natural.internal.Natural                : Nonempty Nat -> Natural
 Abort.abortWhen                         : Boolean ->{Abort} () (+2 metadata)
 Abort.abortWhen.doc                     : Doc (+2 metadata)
 Abort.toBug                             : '{g, Abort} a ->{g} a (+2 metadata)
 Abort.toBug.doc                         : Doc (+2 metadata)
 Char.ascii.fromBase36Digit              : Nat -> Optional Char (+2 metadata)
 Char.ascii.fromBase36Digit.doc          : Doc (+2 metadata)
 Char.ascii.toBase36Digit                : Char -> Optional Nat (+2 metadata)
 Char.ascii.toBase36Digit.doc            : Doc (+2 metadata)
 Int.!=                                  : Int -> Int -> Boolean (+2 metadata)
 Int.max                                 : Int -> Int -> Int (+2 metadata)
 Int.min                                 : Int -> Int -> Int (+2 metadata)
 Int.mod.test                            : [Result] (+3 metadata)
 List.Nonempty.appendList                : Nonempty a
                                         -> [a]
                                         -> Nonempty a (+2 metadata)
 List.Nonempty.appendList.doc            : Doc (+2 metadata)
 List.Nonempty.reverse                   : Nonempty a -> Nonempty a (+2 metadata)
 List.Nonempty.reverse.doc               : Doc (+2 metadata)
 List.dropRightWhile                     : (a ->{g} Boolean)
                                         -> [a]
                                         ->{g} [a] (+2 metadata)
 List.dropRightWhile.doc                 : Doc (+2 metadata)
 List.slidingPairs                       : [a] -> [(a, a)] (+2 metadata)
 List.slidingPairs.doc                   : Doc (+2 metadata)
 List.slidingPairs.tests.concat          : [Result] (+3 metadata)
 List.updateAt                           : (a ->{g} a)
                                         -> Nat
                                         -> [a]
                                         ->{g} [a] (+2 metadata)
 List.updateAt.doc                       : Doc (+2 metadata)
 List.updateAt.tests.updates             : [Result] (+3 metadata)
 Nat.!=                                  : Nat -> Nat -> Boolean (+2 metadata)
 Nat.max                                 : Nat -> Nat -> Nat (+2 metadata)
 Nat.min                                 : Nat -> Nat -> Nat (+2 metadata)
 Natural.*                               : Natural
                                         -> Natural
                                         -> Natural (+3 metadata)
 Natural.+                               : Natural
                                         -> Natural
                                         -> Natural (+3 metadata)
 Natural.-                               : Natural
                                         -> Natural
                                         -> Natural (+3 metadata)
 ┌ Natural./                             : Natural
                                         -> Natural
                                         -> Optional Natural (+2 metadata)
 └ Natural.div                           : Natural
                                         -> Natural
                                         -> Optional Natural (+2 metadata)
 ┌ Natural.<                             : Natural
                                         -> Natural
                                         -> Boolean (+3 metadata)
 └ Natural.lt                            : Natural
                                         -> Natural
                                         -> Boolean (+3 metadata)
 ┌ Natural.<=                            : Natural
                                         -> Natural
                                         -> Boolean (+3 metadata)
 └ Natural.lteq                          : Natural
                                         -> Natural
                                         -> Boolean (+3 metadata)
 ┌ Natural.==                            : Natural
                                         -> Natural
                                         -> Boolean (+2 metadata)
 └ Natural.eq                            : Natural
                                         -> Natural
                                         -> Boolean (+2 metadata)
 ┌ Natural.>                             : Natural
                                         -> Natural
                                         -> Boolean (+3 metadata)
 └ Natural.gt                            : Natural
                                         -> Natural
                                         -> Boolean (+3 metadata)
 ┌ Natural.>=                            : Natural
                                         -> Natural
                                         -> Boolean (+3 metadata)
 └ Natural.gteq                          : Natural
                                         -> Natural
                                         -> Boolean (+3 metadata)
 ┌ Natural.^                             : Natural -> Nat -> Natural (+2 metadata)
 └ Natural.pow                           : Natural -> Nat -> Natural (+2 metadata)
 Natural.div!                            : Natural
                                         -> Natural
                                         ->{Abort} Natural (+2 metadata)
 Natural.divMod                          : Natural
                                         -> Natural
                                         -> Optional (Natural, Natural) (+2 metadata)
 Natural.divMod!                         : Natural
                                         -> Natural
                                         ->{Abort} (Natural, Natural) (+3 metadata)
 Natural.doc                             : Doc (+2 metadata)
 Natural.docs.arithmetic                 : Doc (+2 metadata)
 Natural.docs.constructing               : Doc (+2 metadata)
 Natural.docs.converting                 : Doc (+2 metadata)
 Natural.docs.relations                  : Doc (+2 metadata)
 Natural.fromNat                         : Nat -> Natural (+3 metadata)
 Natural.fromNat.doc                     : Doc (+2 metadata)
 Natural.internal.bitMask                : Nat (+3 metadata)
 Natural.internal.bitWidth               : Nat (+2 metadata)
 Natural.internal.digits                 : Natural -> Nonempty Nat (+2 metadata)
 Natural.internal.divImpl                : Natural
                                         -> Natural
                                         ->{Abort} (Natural, Natural) (+2 metadata)
 Natural.internal.fromNats               : [Nat] -> Natural (+3 metadata)
 Natural.internal.mkNatural              : [Nat] -> Natural (+2 metadata)
 Natural.internal.normalize              : Natural -> Natural (+3 metadata)
 Natural.internal.radix                  : Nat (+3 metadata)
 Natural.isZero                          : Natural -> Boolean (+2 metadata)
 Natural.isZero.doc                      : Doc (+2 metadata)
 Natural.mod                             : Natural
                                         -> Natural
                                         -> Optional Natural (+2 metadata)
 Natural.mod!                            : Natural
                                         -> Natural
                                         ->{Abort} Natural (+2 metadata)
 Natural.mod!.doc                        : Doc (+2 metadata)
 Natural.mod.doc                         : Doc (+2 metadata)
 Natural.one                             : Natural (+3 metadata)
 Natural.one.doc                         : Doc (+2 metadata)
 Natural.parse                           : Text
                                         -> Nat
                                         -> Optional Natural (+3 metadata)
 Natural.parse!                          : Text
                                         -> Nat
                                         ->{Abort} Natural (+3 metadata)
 Natural.parse!.doc                      : Doc (+2 metadata)
 Natural.parse!.tests.roundtrip          : [Result] (+3 metadata)
 Natural.parse.doc                       : Doc (+2 metadata)
 Natural.parse.tests.roundtrip           : [Result] (+3 metadata)
 Natural.pow.tests.powerOfOne            : [Result] (+3 metadata)
 Natural.pow.tests.powerOfPower          : [Result] (+3 metadata)
 Natural.pow.tests.powerOfProduct        : [Result] (+3 metadata)
 Natural.pow.tests.powerOfZero           : [Result] (+3 metadata)
 Natural.pow.tests.product               : [Result] (+3 metadata)
 Natural.pow.tests.quotient              : [Result] (+3 metadata)
 Natural.tests.additionAssociative       : [Result] (+4 metadata)
 Natural.tests.additionCommutative       : [Result] (+4 metadata)
 Natural.tests.additionZero              : [Result] (+4 metadata)
 Natural.tests.distributiveLaw           : [Result] (+4 metadata)
 Natural.tests.gen.natural               : '{Gen} Natural (+3 metadata)
 Natural.tests.multiplicationAssociative : [Result] (+4 metadata)
 Natural.tests.multiplicationCommutative : [Result] (+4 metadata)
 Natural.tests.multiplicationZero        : [Result] (+4 metadata)
 Natural.tests.subtractLeftAdjoint       : [Result] (+4 metadata)
 Natural.tests.subtraction               : [Result] (+4 metadata)
 Natural.tests.zeroDivisors              : [Result] (+4 metadata)
 Natural.toDecimalText                   : Natural -> Text (+3 metadata)
 Natural.toDecimalText.doc               : Doc (+3 metadata)
 Natural.toHex                           : Natural -> Text (+3 metadata)
 Natural.toNat                           : Natural -> Optional Nat (+2 metadata)
 Natural.toNat.doc                       : Doc (+2 metadata)
 Natural.toNat.tests.roundtrip           : [Result] (+3 metadata)
 Natural.toText                          : Natural
                                         -> Nat
                                         -> Optional Text (+3 metadata)
 Natural.toText!                         : Natural
                                         -> Nat
                                         ->{Abort} Text (+2 metadata)
 Natural.toText.doc                      : Doc (+3 metadata)
 Natural.zero                            : Natural (+3 metadata)
 Natural.zero.doc                        : Doc (+2 metadata)
 Optional.note                           : e
                                         -> Optional a
                                         ->{Throw e} a (+2 metadata)
 Optional.note.doc                       : Doc (+2 metadata)
 Tuple.bimap                             : (a ->{g} b)
                                         -> (a, a)
                                         ->{g} (b, b) (+2 metadata)
 Tuple.bimap.doc                         : Doc (+2 metadata)
 test.laws.adjoint                       : ∀ o g6 g5 g4 g3 g2 g1 g t.
                                           '{g6} o
                                           -> (o ->{g4} o ->{g5} t)
                                           -> (o ->{g3} o ->{g2} o)
                                           -> (o ->{g1} o ->{g} o)
                                           ->{g6, g5, g4, g3, g2, g1, g} Test (+2 metadata)
 when                                    : Boolean
                                         -> '{e} ()
                                         ->{e} () (+2 metadata)
 when.doc                                : Doc (+2 metadata)

Move `Universal.<` and friends to a new name

This gives the Universal.< function (and > etc) the same treatment as when we moved Universal.== to Universal.===, and for the same reason. Structural comparison is almost always never the comparison you want, in particular because of things like unisonweb/unison#2083, and having a name in common use like < is potentially confusing.

Introduced Nat.< etc. as well as Int.< etc.
Added some documentation to the Universal namespace.

The changes summarized below are available for you to review, using the following command:

pull-request.load https://github.com/unisonweb/base:.trunk [email protected]:runarorama/bv2:.prs.universal

Updates:

 Universal.compareOn : (a ->{e} x) -> a -> a ->{e} Ordering
 -  base.Universal.compareOn.doc : Doc.Deprecated
 +  Universal.compareOn.doc      : Doc

 Universal.compareOn.doc : Doc.Deprecated
 ↓
 Universal.compareOn.doc : Doc
 +  unisoncomputing2021 : License
 +  unisoncomputing2020 : License
 +  runarorama          : Author

 Universal.max : a -> a -> a
 -  base.Universal.max.doc : Doc.Deprecated
 +  Universal.max.doc      : Doc

 Universal.max.doc : Doc.Deprecated
 ↓
 Universal.max.doc : Doc
 +  unisoncomputing2021 : License
 +  unisoncomputing2020 : License
 +  runarorama          : Author

 Universal.min : a -> a -> a
 -  base.Universal.min.doc : Doc.Deprecated
 +  Universal.min.doc      : Doc

 Universal.min.doc : Doc.Deprecated
 ↓
 Universal.min.doc : Doc
 +  unisoncomputing2021 : License
 +  unisoncomputing2020 : License
 +  runarorama          : Author

 Universal.ordering : a -> a -> Ordering
 -  base.Universal.ordering.doc : Doc.Deprecated
 +  Universal.ordering.doc      : Doc

 Universal.ordering.doc : Doc.Deprecated
 ↓
 Universal.ordering.doc : Doc
 +  unisoncomputing2021 : License
 +  unisoncomputing2020 : License
 +  runarorama          : Author

 patch patch (added 4 updates)

Added definitions:

 Universal.compare.doc         : Doc (+2 metadata)
 Universal.identical.doc       : Doc (+2 metadata)
 Universal.notIdentical.doc    : Doc (+2 metadata)
 Universal.precedes.doc        : Doc (+2 metadata)
 Universal.precedesOrEqual.doc : Doc (+2 metadata)
 Universal.succeeds.doc        : Doc (+2 metadata)
 Universal.succeedsOrEqual.doc : Doc (+2 metadata)

Removed definitions:

 Universal.ordering.doc.snippet1 : Doc.Deprecated

Name changes:

Original          Changes
 Float.gt          Float.> (added)

 Float.gteq        Float.>= (added)

 Float.lt          Float.< (added)

 Float.lteq        Float.<= (added)

 Int.gt            Int.> (added)

 Int.gteq          Int.>= (added)

 Int.lt            Int.< (added)

 Int.lteq          Int.<= (added)

 Nat.gt            Nat.> (added)

 Nat.gteq          Nat.>= (added)

 Nat.lt            Nat.< (added)

 Nat.lteq          Nat.<= (added)

 Set.equals        Set.== (added)

 Universal.!=      Universal.notIdentical (added)
                   Universal.!= (removed)

 Universal.<       Universal.precedes (added)
                   Universal.< (removed)

 Universal.<=      precedesOrEqual (added)
                   Universal.<= (removed)

 Universal.===     Universal.identical (added)

 Universal.>       Universal.succeeds (added)
                   Universal.> (removed)

 Universal.>=      Universal.succeedsOrEqual (added)
                   Universal.>= (removed)

MVar/TVar documentation/tweaks

The changes summarized below are available for you to review, using the
following command:

pull-request.load https://github.com/unisonweb/base:.trunk https://github.com/dolio/unison-base-contrib:.work.doc.concurrency

Updates:

 io.MVar.tryPut : MVar a -> a ->{IO} Either Failure Boolean
 ↓
 io.MVar.tryPut : MVar a -> a ->{IO, Exception} Boolean
 +  unisoncomputing2021 : License
 +  dolio               : Author

 io.MVar.tryRead : MVar a ->{IO} Either Failure (Optional a)
 ↓
 io.MVar.tryRead : MVar a ->{IO, Exception} Optional a
 +  unisoncomputing2021 : License
 +  dolio               : Author

Added definitions:

 io.MVar.isEmpty.doc  : Doc (+2 metadata)
 io.MVar.new.doc      : Doc (+2 metadata)
 io.MVar.newEmpty.doc : Doc (+2 metadata)
 io.MVar.put.doc      : Doc (+2 metadata)
 io.MVar.read.doc     : Doc (+2 metadata)
 io.MVar.swap.doc     : Doc (+2 metadata)
 io.MVar.take.doc     : Doc (+2 metadata)
 io.MVar.tryPut.doc   : Doc (+2 metadata)
 io.MVar.tryRead.doc  : Doc (+2 metadata)
 io.MVar.tryTake.doc  : Doc (+2 metadata)
 io.TVar.modify       : TVar a -> (a ->{STM} a) ->{STM} () (+2 metadata)
 io.TVar.modify.doc   : Doc (+2 metadata)
 io.TVar.new.doc      : Doc (+2 metadata)
 io.TVar.newIO.doc    : Doc (+2 metadata)
 io.TVar.read.doc     : Doc (+2 metadata)
 io.TVar.readIO.doc   : Doc (+2 metadata)
 io.TVar.state        : TVar s
                      -> (s ->{e} (a, s))
                      ->{e, STM} a (+2 metadata)
 io.TVar.state.doc    : Doc (+2 metadata)
 io.TVar.swap.doc     : Doc (+2 metadata)
 io.TVar.write.doc    : Doc (+2 metadata)

Name changes:

Original            Changes
 io.MVar.tryPut      io.MVar.tryPut.impl (added)
                     io.MVar.tryPut (removed)

 io.MVar.tryRead     io.MVar.tryRead.impl (added)
                     io.MVar.tryRead (removed)

`getLine` and `console.getLine`

.prs.getlineclean> diff.namespace ._base .prs.getlineclean

  Added definitions:
  
    1. io.console.getLine     : '{IO, Exception} Text (+2 metadata)
    2. io.console.getLine.doc : Doc (+2 metadata)
    3. io.getLine             : Handle ->{IO, Exception} Text (+2 metadata)
    4. io.getLine.doc         : Doc (+2 metadata)

.prs.getlineclean> view 1-4

  io.console.getLine : '{IO, Exception} Text
  io.console.getLine _ = io.getLine stdIn
  
  io.console.getLine.doc : Doc
  io.console.getLine.doc =

  io.console.getLine : '{IO, Exception} Text
  io.console.getLine _ = io.getLine stdIn
  
  io.console.getLine.doc : Doc
  io.console.getLine.doc =
    use Text ++
    {{ Reads a line from standard input.
    
    # Example
    
      @typecheck ```
      printLine "Important question: what's your favorite type of pie?"
      printLine "> "
      pie = !console.getLine
      printLine (pie ++ "!? No way, me too!!! 🎉")
      ``` }}
  
  io.getLine : Handle ->{IO, Exception} Text
  io.getLine h = toException (getLine.impl h)
  
  io.getLine.doc : Doc
  io.getLine.doc =
    {{ Reads a line from the given handle, assuming the default system encoding.
    
    🚧 {type Handle} will soon support setting the encoding explicitly.
    
    # Example
    
      @typecheck ```
      f = openFile (FilePath "/path/to/file.csv") Read
      finally
        '(closeFile f) 'let
          header = io.getLine f
          printLine header
      ``` }}

Add names for old IO types

This adds a Deprecated names for old datatypes used in IO.Deprecated, so that they show up with e.g. Handle.Deprecated rather than just hashes.

The changes summarized below are available for you to review, using the following command:

pull-request.load https://github.com/unisonweb/base:.trunk [email protected]:runarorama/bv2:.prs.oldio

Added definitions:

 unique type io.deprecated.BufferMode.Deprecated
 type io.deprecated.Error.Deprecated
 unique type io.deprecated.ErrorType.Deprecated
 unique type io.deprecated.FilePath.Deprecated
 unique type io.deprecated.Handle.Deprecated
 unique type io.deprecated.HostName.Deprecated
 type io.deprecated.Mode.Deprecated
 unique type io.deprecated.SeekMode.Deprecated
 unique type io.deprecated.ServiceName.Deprecated
 unique type io.deprecated.Socket.Deprecated
 unique type io.deprecated.ThreadId.Deprecated

Add binary encoding/decoding builtins of various widths and endian-ness

Added these in latest trunk

.prs.basebytes> diff.namespace ._base.Bytes

Added definitions:

1.  decodeNat16be : Bytes -> Optional (Nat, Bytes)
2.  decodeNat16le : Bytes -> Optional (Nat, Bytes)
3.  decodeNat32be : Bytes -> Optional (Nat, Bytes)
4.  decodeNat32le : Bytes -> Optional (Nat, Bytes)
5.  decodeNat64be : Bytes -> Optional (Nat, Bytes)
6.  decodeNat64le : Bytes -> Optional (Nat, Bytes)
7.  encodeNat16be : Nat -> Bytes
8.  encodeNat16le : Nat -> Bytes
9.  encodeNat32be : Nat -> Bytes
10. encodeNat32le : Nat -> Bytes
11. encodeNat64be : Nat -> Bytes
12. encodeNat64le : Nat -> Bytes

BDD style test helpers and docs

Adds helpful BDD-style test helpers to the testing library. By accepting both a label and a list of tests we avoid superfluous parens.

Also clears up confusion between asserts which are meant to be used in regular code vs the expectation helpers which are specifically for tests. I changed the new expectEquals to return a Test so that it can be used inline without an "expect"

Assertions for "real" code were moved to the Debug namespace.

Adds a readme to the test namespace which shows an example of how to write readable tests. Here's an example of what things look like when doing non-trivial tests (assume each block includes multiple tests even though I've only provided one):

Before

test> readme.example =
    test.run <| tests [
      label "Text.reverse" <| (
        tests [
          label "reverses a word" let
           result = Text.reverse "pomegranate"
           expected = "etanargemop"
           expect (assertEquals expected result)
       ])
    ]

After

test> readme.example =
  run <| describe "Text.reverse" [
    it "reverses a word" let
      result = Text.reverse "pomegranate"
      expected = "etanargemop"
      expectEquals expected result
    ,
]

Code review

The changes summarized below are available for you to review, using the following command:

pull-request.load https://github.com/unisonweb/base:.trunk https://github.com/ChrisPenner/unison-codebase:.prs.base._newtest

Updates:

 patch test.patch (added 2 updates)

Added definitions:

 test.describe         : Text -> [Test] -> Test (+2 metadata)
 test.describe.doc     : Doc (+2 metadata)
 test.expectEquals.doc : Doc (+2 metadata)
 test.it.doc           : Doc (+2 metadata)
 test.readme.example   : [Result] (+2 metadata)
 test.expectEquals     : a -> a -> Test (+2 metadata)
 test.it               : Text -> Test -> Test (+2 metadata)
 test.readme           : Doc (+2 metadata)

Name changes:

Original                  Changes
 test.assert               Debug.assert (added)
                           test.assert (removed)

 test.assertEquals         Debug.assertEquals (added)
                           test.assertEquals (removed)

 test.assert.doc           Debug.assert.doc (added)
                           test.assert.doc (removed)

 test.assertEquals.doc     Debug.assertEquals.doc (added)
                           test.assertEquals.doc (removed)

Adding an unsafeRun! function for Exception

  • This PR adds a function called Exception.unsafeRun! which will call the bug built-in if an exception is raised. It's a bit of a stopover until the solution for https://github.com/unisonweb/unison/issues/2025 lands.

Code review

The changes summarized below are available for you to review, using the following command:

pull-request.load [email protected]:unisonweb/base:.trunk.Exception [email protected]:rlmark/my-unison-repo2:.myBase.unsafeRunPr.Exception

Added definitions:

 unsafeRun!     : '{g, Exception} a ->{g} a (+2 metadata)
 unsafeRun!.doc : Doc (+3 metadata)

Inconsistent existence of operators across different base types

I have checked the definition of comparison operators for the various types. The parallelism between operators like > and prefix functions like gt is incomplete: Universal has neq but not !=, and Text has != but not neq, nor any of < <= > >=. Both neq and != are lacking for Nat, Int and Float. Char and Boolean only have ==. Bytes, List and Tuple have no comparison operators defined at all. Otoh, == is defined for Bag, Map and Set. Are there plans to make this more consistent?

Thanks to @meijeru for reporting.

MurmurHash implementation

This was a straightforward port of https://hackage.haskell.org/package/murmur-hash-0.1.0.9/docs/src/Data-Digest-Murmur64.html#hash64AddWord64 and I linked the creator of that package as an additional author in the metadata.

I was having a hard time finding test vectors for this. It might be that this is what I want: https://github.com/yuanzzx/murmurhash-java/blob/master/src/test/java/ie/ucd/murmur/MurmurHashTest.java but there are a number of variants of this hashing algorithm so I'll need to look into that.

The changes summarized below are available for you to review, using the following
command:

pull-request.load https://github.com/unisonweb/base:.trunk https://github.com/pchiusano/unisoncode:.prs.murmur

Added definitions:

 MurmurHash.Readme                         : Doc (+2 metadata)
 MurmurHash.add                            : Nat -> Nat -> Nat (+3 metadata)
 MurmurHash.add.doc                        : Doc (+2 metadata)
 MurmurHash.finish                         : Nat -> Nat (+3 metadata)
 MurmurHash.finish.doc                     : Doc (+2 metadata)
 MurmurHash.impl.murmur_m                  : Nat (+3 metadata)
 MurmurHash.impl.murmur_r                  : Nat (+3 metadata)
 MurmurHash.initialSeed                    : Nat (+2 metadata)
 metadata.authors.thomasschilling          : Author
 metadata.authors.thomasschilling.guid     : GUID
 metadata.copyrightHolders.thomasschilling : CopyrightHolder
.prs.murmur> display MurmurHash.Readme

  This namespace has a 64-bit murmur hash implementation. Use `add` to mix a Nat into
  the hash, and finish to finalize the hash, producing a 64-bit Nat.
  
      MurmurHash.add initialSeed 2 |> MurmurHash.add 329048 |> finish
      ⧨
      9723437166784648328
  
  You can use any value to initialize the hash.
  
  # Credits
  
    Implementation is a port of this Haskell library by Thomas Schilling, which is
    BSD-licensed.

Random number generating ability

pull-request.load https://github.com/unisonweb/base:.trunk https://github.com/pchiusano/unisoncode:.prs.random2

We started on this during office hours the other day and I got it polished up. Here's the final interface:

ability Random where
  nat : Nat
  bytes : Nat -> Bytes
  split : {Random} (forall g a. '{Random,g} a ->{g} a)

The RNG state and update rule is encapsulated in the handler of the ability. This works out nicer than using something like Store / State where the RNG state leaks into the API.

This PR just has one handler based on a linear congruential generator but it would be great to get other implementations. (Like @atacratic has a mersenne twister implementation - would you like to port that to this API?)

The implementation uses helper functions from #11. Kinda cool is that this could still be merged ahead of #11 and those functions will just show up as unnamed... then when #11 gets merged it'll start using the newly provided names for the functions. Though I think it would be nice during PR review to get a warning about relying on unnamed definitions, or maybe todo could report on that.

Future work

We didn't get too far on writing helper functions for generating different kinds of values. (Like floating point numbers with various distributions would be good).

Screen Shot 2021-06-09 at 10 42 57 PM

Screen Shot 2021-06-09 at 10 43 16 PM

Screen Shot 2021-06-09 at 10 43 39 PM

Screen Shot 2021-06-09 at 10 43 52 PM

Added definitions:

 ability Random (+2 metadata)
 Random.bytes                  : Nat ->{Random} Bytes
 Random.nat.impl               : {Random} Nat
 Random.split.impl             : {Random} (∀ g a. '{g, Random} a ->{g} a)
 Random.boolean                : '{Random} Boolean (+2 metadata)
 Random.boolean.doc            : Doc (+2 metadata)
 Random.bytes.doc              : Doc (+2 metadata)
 Random.doc                    : Doc (+2 metadata)
 Random.impl.bytesFromNats     : '{g, Random} Nat -> Nat ->{g, Random} Bytes (+2 metadata)
 Random.impl.bytesFromNats.doc : Doc (+2 metadata)
 Random.lcg                    : Nat -> '{g, Random} a ->{g} a (+2 metadata)
 Random.lcg.doc                : Doc (+2 metadata)
 Random.lcg.handler            : Nat -> Request {Random} a -> a (+2 metadata)
 Random.lcg.handler.doc        : Doc (+2 metadata)
 Random.nat                    : '{Random} Nat (+2 metadata)
 Random.nat.doc                : Doc (+2 metadata)
 Random.natIn                  : Nat -> Nat ->{Random} Nat (+2 metadata)
 Random.natIn.doc              : Doc (+2 metadata)
 Random.natIn.tests.ex1        : [Result] (+3 metadata)
 Random.split                  : '{Random} '{g, Random} t ->{g} t (+2 metadata)
 Random.split.doc              : Doc (+2 metadata)

Add library for representing durations

Before submitting a pull request, please doublecheck that you have included

Code review

.> pr.create https://github.com/unisonweb/base:.trunk https://github.com/ChrisPenner/unison- The changes summarized below are available for you to review, using the following command:

pull-request.load https://github.com/unisonweb/base:.trunk https://github.com/ChrisPenner/unison-codebase:.prs.base._duration2

Updates:

 metadata.licenses.unisoncomputing2021 : License
 +  duration.!= : Duration -> Duration -> Boolean

Added definitions:

 unique type duration.Duration (+3 metadata)
 duration.Duration.Nanoseconds     : Nat -> Duration
 duration.!=                       : Duration -> Duration -> Boolean (+3 metadata)
 duration.%                        : Duration -> Duration -> Duration (+3 metadata)
 duration.*                        : Nat -> Duration -> Duration (+3 metadata)
 duration.+                        : Duration -> Duration -> Duration (+3 metadata)
 duration.-                        : Duration -> Duration -> Duration (+3 metadata)
 duration.<                        : Duration -> Duration -> Boolean (+3 metadata)
 duration.<=                       : Duration -> Duration -> Boolean (+3 metadata)
 duration.==                       : Duration -> Duration -> Boolean (+3 metadata)
 duration.>                        : Duration -> Duration -> Boolean (+3 metadata)
 duration.>=                       : Duration -> Duration -> Boolean (+3 metadata)
 duration.asHours                  : Duration -> Nat (+3 metadata)
 duration.asMicroseconds           : Duration -> Nat (+3 metadata)
 duration.asMilliseconds           : Duration -> Nat (+3 metadata)
 duration.asMinutes                : Duration -> Nat (+3 metadata)
 duration.asNanoseconds            : Duration -> Nat (+3 metadata)
 duration.asSeconds                : Duration -> Nat (+3 metadata)
 duration.displayDuration          : Duration -> Text (+3 metadata)
 duration.!=.doc                   : Doc (+2 metadata)
 duration.%.doc                    : Doc (+2 metadata)
 duration.+.doc                    : Doc (+2 metadata)
 duration.-.doc                    : Doc (+2 metadata)
 duration.<.doc                    : Doc (+2 metadata)
 duration.<=.doc                   : Doc (+2 metadata)
 duration.==.doc                   : Doc (+2 metadata)
 duration.>.doc                    : Doc (+2 metadata)
 duration.>=.doc                   : Doc (+2 metadata)
 duration.Duration.doc             : Doc
 duration.asHours.doc              : Doc
 duration.asMicroseconds.doc       : Doc
 duration.asMilliseconds.doc       : Doc
 duration.asMinutes.doc            : Doc
 duration.asNanoseconds.doc        : Doc
 duration.asSeconds.doc            : Doc
 duration.displayDuration.doc      : Doc (+1 metadata)
 duration.hour.doc                 : Doc (+2 metadata)
 duration.microsecond.doc          : Doc (+2 metadata)
 duration.millisecond.doc          : Doc (+2 metadata)
 duration.minute.doc               : Doc (+2 metadata)
 duration.nanosecond.doc           : Doc (+2 metadata)
 duration.second.doc               : Doc (+2 metadata)
 duration.hour                     : Duration (+3 metadata)
 duration.microsecond              : Duration (+3 metadata)
 duration.millisecond              : Duration (+3 metadata)
 duration.minute                   : Duration (+3 metadata)
 duration.nanosecond               : Duration (+3 metadata)
 duration.readme                   : Doc (+3 metadata)
 duration.Duration.tests.roundtrip : [Result] (+1 metadata)
 duration.second                   : Duration (+3 metadata)
 duration.displayDuration.tests    : [Result] (+1 metadata)

 patch duration.patch (added 21 updates)

Name changes:

Original                                  Changes
 metadata.authors.chrispenner

 metadata.copyrightHolders.chrispenner

 metadata.licenses.chrispenner             metadata.licenses.chrisPenner2021 (added)
                                           metadata.licenses.chrispenner (removed)

 metadata.authors.chrispenner.guid

Switch List.initialize to be tail recursive and add new docs for it

Also provided updated docs.

Screen Shot 2021-06-04 at 10 42 50 AM

The changes summarized below are available for you to review, using the following command:

pull-request.load https://github.com/unisonweb/base:.trunk https://github.com/pchiusano/unisoncode:.prs.initialize

I'd use the squash merged version for this, my branch has a bit of local churn.

Updates:

 List.initialize : Nat -> (Nat ->{e} a) ->{e} [a]
 ↓
 List.initialize : Nat -> (Nat ->{e} a) ->{e} [a]
 -  unisoncomputing2020            : License
 -  base.List.initialize.doc       : Doc.Deprecated
 +  unisoncomputing2021            : License
 +  pchiusano                      : Author
 +  authors.vanev                  : Author
 +  initialize.List.initialize.doc : Doc
 +  runarorama                     : Author

 List.initialize.doc : Doc.Deprecated
 ↓
 List.initialize.doc : Doc
 -  unisoncomputing2020 : License
 +  unisoncomputing2021 : License
 +  pchiusano           : Author
 +  authors.vanev       : Author
 +  runarorama          : Author

There were 6 auto-propagated updates.

 patch patch (added 1 updates)

Add wrapper types to `io`

This adds Text wrapper types HostName, ServiceName, and FilePath and updates relevant io operations to use these instead of Text.

The changes summarized below are available for you to review, using the following command:

pull-request.load https://github.com/unisonweb/base:.trunk [email protected]:runarorama/bv2:.newtypes

Updates:

 List.initialize : Nat -> (Nat ->{e} a) ->{e} [a]
 +  unisoncomputing2020 : License

 io.clientSocket : Text -> Text ->{IO, Exception} io.Socket
 ↓
 io.clientSocket : HostName -> ServiceName ->{IO, Exception} io.Socket
 +  unisoncomputing2020 : License
 +  runarorama          : Author

 io.createDirectory : Text ->{IO, Exception} ()
 ↓
 io.createDirectory : FilePath ->{IO, Exception} ()
 +  unisoncomputing2020 : License
 +  runarorama          : Author

 io.createTempDirectory : Text ->{IO} Either Failure Text
 ↓
 io.createTempDirectory : FilePath ->{IO, Exception} FilePath
 +  unisoncomputing2020 : License
 +  runarorama          : Author

 io.fileExists : Text ->{IO, Exception} Boolean
 ↓
 io.fileExists : FilePath ->{IO, Exception} Boolean
 +  unisoncomputing2020 : License
 +  runarorama          : Author

 io.getCurrentDirectory : '{IO, Exception} Text
 ↓
 io.getCurrentDirectory : '{IO, Exception} FilePath
 +  unisoncomputing2020 : License
 +  runarorama          : Author

 io.getFileSize : Text ->{IO, Exception} Nat
 ↓
 io.getFileSize : FilePath ->{IO, Exception} Nat
 +  unisoncomputing2020 : License
 +  runarorama          : Author

 io.getFileTimestamp : Text ->{IO, Exception} Nat
 ↓
 io.getFileTimestamp : FilePath ->{IO, Exception} EpochTime
 +  unisoncomputing2020 : License
 +  runarorama          : Author

 io.getTempDirectory : '{IO, Exception} Text
 ↓
 io.getTempDirectory : '{IO, Exception} FilePath
 +  unisoncomputing2020 : License
 +  runarorama          : Author

 io.isDirectory : Text ->{IO, Exception} Boolean
 ↓
 io.isDirectory : FilePath ->{IO, Exception} Boolean
 +  unisoncomputing2020 : License
 +  runarorama          : Author

 io.openFile : Text -> FileMode ->{IO, Exception} io.Handle
 ↓
 io.openFile : FilePath -> FileMode ->{IO, Exception} io.Handle
 +  unisoncomputing2020 : License
 +  runarorama          : Author

 io.removeDirectory : Text ->{IO, Exception} ()
 ↓
 io.removeDirectory : FilePath ->{IO, Exception} ()
 +  unisoncomputing2020 : License
 +  runarorama          : Author

 io.removeFile : Text ->{IO, Exception} ()
 ↓
 io.removeFile : FilePath ->{IO, Exception} ()
 +  unisoncomputing2020 : License
 +  runarorama          : Author

 io.renameDirectory : Text -> Text ->{IO, Exception} ()
 ↓
 io.renameDirectory : FilePath -> FilePath ->{IO, Exception} ()
 +  unisoncomputing2020 : License
 +  runarorama          : Author

 io.renameFile : Text -> Text ->{IO, Exception} ()
 ↓
 io.renameFile : FilePath -> FilePath ->{IO, Exception} ()
 +  unisoncomputing2020 : License
 +  runarorama          : Author

 io.serverSocket : Optional Text -> Text ->{IO, Exception} io.Socket
 ↓
 io.serverSocket : Optional HostName -> ServiceName ->{IO, Exception} io.Socket
 +  unisoncomputing2020 : License
 +  runarorama          : Author

 io.setCurrentDirectory : Text ->{IO, Exception} ()
 ↓
 io.setCurrentDirectory : FilePath ->{IO, Exception} ()
 +  unisoncomputing2020 : License
 +  runarorama          : Author

 io.socketPort : io.Socket ->{IO} Either Failure Nat
 ↓
 io.socketPort : io.Socket ->{IO, Exception} Nat
 +  unisoncomputing2020 : License
 +  runarorama          : Author

 patch patch (added 19 updates)

Added definitions:

 unique type io.FilePath
 unique type io.HostName
 unique type io.ServiceName
 io.HostName.HostName       : Text -> HostName
 io.ServiceName.ServiceName : Text -> ServiceName
 io.FilePath.toText         : FilePath -> Text (+2 metadata)
 io.HostName.doc            : Doc (+2 metadata)
 io.HostName.toText         : HostName -> Text (+2 metadata)
 io.ServiceName.doc         : Doc (+2 metadata)
 io.ServiceName.toText      : ServiceName -> Text (+2 metadata)
 io.clientSocket.doc        : Doc (+2 metadata)

Removed definitions:

 io.getTemporaryDirectory : '{IO, Exception} Text

Name changes:

Original                   Changes
 io.createTempDirectory     io.createTempDirectory.impl (added)
                            io.createTempDirectory (removed)

 io.socketPort              io.socketPort.impl (added)
                            io.socketPort (removed)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.