// Generated by bynkc — do not edit by hand.
// commons fragment.demo

import { Ok, Err, Some, None, type Result, type Option, type ValidationError } from "./runtime.js";

export type Metres = number & { readonly __brand: "Metres" };

export const Metres = {
  of(value: number): Result<Metres, ValidationError> {
    if (!Number.isInteger(value)) {
      return Err({ field: "Metres", message: "must be an integer", value });
    }
    if (!(value >= 0)) {
      return Err({ field: "Metres", message: "must be non-negative", value });
    }
    return Ok(value as Metres);
  },
  unsafe(value: number): Metres {
    return value as Metres;
  },
};

export function double(n: number): number {
  return n * 2;
}

