Skip to content

Instantly share code, notes, and snippets.

@okayurisotto
Created February 5, 2024 03:46
Show Gist options
  • Save okayurisotto/89da435576c9841cf5043a50a333ce51 to your computer and use it in GitHub Desktop.
Save okayurisotto/89da435576c9841cf5043a50a333ce51 to your computer and use it in GitHub Desktop.
πŸ€”
class Software {
local Semver = (str: String) ->
str.matches(Regex(#"^\#(IntStr)\.\#(IntStr)\.\#(IntStr)$"#))
local IntStr = #"(0|[1-9]\d*)"#
local function greet(name: String): String = "Hello, \(name) world!"
name: String(length > 0)
version: String(Semver)
message: String = greet(name)
}
solutions: Listing<Software> = new {
new {
name = "Pkl"
version = "0.25.1"
}
}
/*
* {
* "solutions": [
* {
* "name": "Pkl",
* "version": "0.25.1",
* "message": "Hello, Pkl world!"
* }
* ]
* }
*/
@okayurisotto
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment