Last active
February 3, 2026 20:27
-
-
Save dacr/ba26239bbf4e7fd29266543c8348a9fa to your computer and use it in GitHub Desktop.
com-lihaoyi os-lib basic usage examples / published by https://github.com/dacr/code-examples-manager #8f69aa4e-c71a-4ff7-abab-b19f67d7cf5a/e910907e155acb12eac8b1e8bbfe23ba66dc30fa
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // summary : com-lihaoyi os-lib basic usage examples | |
| // keywords : scala, lihaoyi, os-lib, @testable | |
| // publish : gist | |
| // authors : David Crosson | |
| // license : Apache License Version 2.0 (https://www.apache.org/licenses/LICENSE-2.0.txt) | |
| // id : 8f69aa4e-c71a-4ff7-abab-b19f67d7cf5a | |
| // created-on : 2024-01-06T11:48:22+01:00 | |
| // managed-by : https://github.com/dacr/code-examples-manager | |
| // run-with : scala-cli $file | |
| // --------------------- | |
| //> using scala "3.4.2" | |
| //> using dep "com.lihaoyi::pprint:0.9.0" | |
| // --------------------- | |
| import pprint.{pprintln, tprint} | |
| pprintln(List(1, 2, 3, 4)) | |
| pprintln(List(1, 2, 3, 4), width = 4) | |
| def data = LazyList.continually(java.util.UUID.randomUUID()).take(10000) | |
| pprintln(data, height = 5) | |
| enum Gender(val code: Char) { | |
| case Female extends Gender('F') | |
| case Male extends Gender('M') | |
| } | |
| case class Person( | |
| name: String, | |
| gender: Gender, | |
| age: Int | |
| ) | |
| pprintln(Person("John Doe", Gender.Male, 42)) | |
| pprintln(Person("John Doe", Gender.Male, 42), width = 10) | |
| pprintln( | |
| tprint[Map[java.util.UUID, Person]] | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment