In the early days of FunctionaL City, we inherited a legacy ordinance: a design that relied on obj casting and reflection to inspect our citizens. It was expedient—but not lawful. Payloads were cast into anonymity, provenance was lost, and remixers were forced to guess at runtime.
The Problem: Intrusive Probing of Anonymous Citizens This previous commit introduced a reflection-based dispatcher that operated like a surveillance drone:
let inspect (x: obj) =
let t = x.GetType()
// probe properties, cast values, hope for the best...
This design violated our civic charter:
After laying out the scaffolding for the CivicSet, I quickly realized that implementing a way to represent the union of two sets would require a way to join two or more different types. This called for a union type that could represent two different types Lifted<'A,'B>. I submitted a preliminary design to the City Council.
The city mayor issued a formal rejection:
“All citizens must be types to be considered first-class citizens. Intrusive probing of our citizens should be outlawed in favor of civic citizenship.”
This declaration redefined our infrastructure:
Back to the drawing board. Get some Rock Star’s and coffee brewing…it going to be a long night.
Our initial design allowed the discriminated union of two generic types 'A and 'B. But remixers quickly discovered a recursive trap: either generic type could nest another Lifted<'A,'B>, requiring reflection to inspect nested payloads. This violated our ordinance against runtime guessing.
The solution, replace reflection with a narratable union that included an explicit nested type:
type Lifted<'A,'B> =
| A of LiftedCell<'A>
| B of LiftedCell<'B>
| Nested of LiftedCell<Lifted<'A,'B>>
But first, we needed a way to attach provenance to each lifted type. For this the record LiftedCell<'T> was created:
/// Cell that always carries a payload and optional provenance
type LiftedCell<'T> = { Value: 'T; Provenance: Provenance option }
Every payload is:
See the ordinace here Primitives.md
Instead of probing, we now traverse with signage:
mapA (fun x -> x.ToUpper()) lifted // Transform A payloads with civic clarity
collectProvenance lifted // Trace lineage without surveillance
fold handleA handleB initial lifted // Dispatch lawfully across citizens
These helpers are civic-native. They empower remixers to inspect, transform, and narrate without violating the rights of their citizens.
This transition wasn’t just technical—it was civic. We moved from runtime guessing to type-driven citizenship. From surveillance to stewardship. From obj to ordinance.
The mayor’s veto wasn’t a rejection of progress—it was a call to lawful infrastructure.
City Limits
Primitives ordinance book.
First Order Logic ordinance book.
Civic Set ordinance book.
Keep an eye out for future editions of Message from the Mayor as the city grows and random musings develop along the way. In the meantime, keep an eye on the BlogDistrict README.md for updates.
Signed,
FrankL
Mayor and City Engineer of FunctionaL City