https://github.com/farlee2121/fsspec-originalexperiment
FsSpec in early exploration. Explores routes like being part of the type system, totality testing, and different data formats
https://github.com/farlee2121/fsspec-originalexperiment
Last synced: 2 months ago
JSON representation
FsSpec in early exploration. Explores routes like being part of the type system, totality testing, and different data formats
- Host: GitHub
- URL: https://github.com/farlee2121/fsspec-originalexperiment
- Owner: farlee2121
- Created: 2022-06-10T15:53:01.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-06-10T15:54:47.000Z (almost 3 years ago)
- Last Synced: 2025-02-02T04:23:58.330Z (4 months ago)
- Language: F#
- Homepage:
- Size: 95.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# FsSpec
## What is Spec and why do I want it?
The specification pattern represents constraints in a way that can facilitate validation, classification, and generation.
Applying this constraint concept to the type system allows us to more clearly communicate, enforce, and leverage constraints inherent to our domain.
For example,
```fs
type Percent = int between 0.0 and 1.0
```Enforcing these constraints in our type system reduces the amount of defensive programming required. This is often already accomplished with constructors.
Promoting these constraints to a more consistent member of our type system could reduce validation code, improve validation readability and consistency, and enable
new possibilities for automated correctness verification (i.e. generating values within constraints to see if any unexpected system states can be achieved).## Inspiration
cite clojure.spec and Eric Evans spec document
https://clojure.org/about/spec
https://www.martinfowler.com/apsupp/spec.pdf
Design by Contract
Generative testing
https://fsharpforfunandprofit.com/posts/designing-with-types-single-case-dus/
[Ada constrained numbers](https://en.wikipedia.org/wiki/Ada_(programming_language)#Data_types)## Conclusion
Unfortunately, such an extension to the F# type system is not possible with type providers. Options without type providers provide no meaningful progress over existing techniques.
If you're interested in my investigations, they're all recorded in [doc](./doc/)