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
| // Proposal: in bishabosha/flagged, collapse all type-target annotations into | |
| // named arguments of `@cmd`, and parameter-target annotations into named arguments of `@opt` | |
| // sparse encoding of Annotation: | |
| // type-level encoding of `@opt(help = "foo", positional = true)`. | |
| // It is assumed that if a runtime value is needed, then consumer has access to Defaults Mirror and | |
| // scala.deriving.Mirror.Of[opt] to compute argument list. | |
| // compiletime only consumers can traverse the sparse arguments (and assume defaults for rest) | |
| type X = Ann[ | |
| /* type = */ opt, |
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
| package scalax | |
| object TupleOf { | |
| import Inner.* | |
| type Bound[T0] = T0 match { | |
| case SomeTupleOf[?, arg] => arg | |
| } | |
| type Shape[T0] = T0 match { | |
| case SomeTupleOf[t, ?] => t | |
| } |
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
| #! /usr/bin/env -S scala shebang | |
| //> using dep "com.indoorvivants::toml:0.3.0" | |
| //> using toolkit default | |
| case class Settings( | |
| local: Boolean = true, | |
| `mcp-server`: String = "scala-metals", | |
| url: Option[String] = None | |
| ) |
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
| This prototype was developed on 7th April 2024. | |
| The brief is to design a "clean-room" Scala validation API (based on the | |
| boundary/break mechanism) that can help users transform raw data into a | |
| rich and type-safe aggregate value (such as a Form, or other "data model"). | |
| The idea is a scope that provides a capability to accumulate multiple errors, i.e. | |
| so that component parts that are independent can be tested "at the same time", | |
| rather than abort early on the first error. |
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
| //> using scala 3.8.4 | |
| //> using platform native | |
| import scalanative.unsafe.* | |
| @main def hello = | |
| Zone: | |
| // Defining constant arrays in Scala Native | |
| // Here we try to allocate a 1567891 byte array |
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
| //> using scala "3.8.2" | |
| //> using jmh | |
| // run with `scala --power bench.scala` | |
| package bench | |
| import org.openjdk.jmh.annotations.Benchmark | |
| import org.openjdk.jmh.annotations.BenchmarkMode | |
| import org.openjdk.jmh.annotations.Level |
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
| package runtimeStrawman | |
| import scala.collection.immutable.ArraySeq | |
| import scala.reflect.ClassTag | |
| sealed abstract class VarArgsBuilder[T]: | |
| def add(elem: T): this.type | |
| def addSeq(elems: Seq[T]): this.type | |
| def addArray(elems: Array[T]): this.type | |
| def result(): Seq[T] |
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
| extension (ctx: StringContext) | |
| /** Regex pattern */ | |
| transparent inline def rg(s: Any*): scala.util.matching.Regex = | |
| ctx.raw(s*).r | |
| /** Whitespace-Separated list*/ | |
| transparent inline def ws(s: Any*): IndexedSeq[String] = | |
| ctx.s(s*).split(raw"\s+").filter(_.nonEmpty).toIndexedSeq |
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
| [ | |
| { | |
| "label": "Scala run", | |
| "command": "scala", | |
| "args": [ | |
| "run", | |
| "-M", | |
| "$(if [ -z \"${ZED_CUSTOM_scala_package_name:}\" ] ; then echo \"$ZED_CUSTOM_scala_main_function_name\"; else echo \"${ZED_CUSTOM_scala_package_name:}.$ZED_CUSTOM_scala_main_function_name\"; fi)", | |
| "$ZED_WORKTREE_ROOT" | |
| ], |
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
| <?xml version="1.0" encoding="UTF-8"?> | |
| <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" | |
| "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
| <plist version="1.0"> | |
| <!-- Enhanced Scala Codeless Language Module for BBEdit | |
| Supports advanced syntax highlighting, folding, function indexing, and Metals LSP --> | |
| <dict> | |
| <!-- You must identify the plist as a CLM: --> |
NewerOlder