taidalog / fermata Goto Github PK
View Code? Open in Web Editor NEWAn F# helper library for working with values of basic types in F#. Compatible with Fable.
Home Page: https://www.nuget.org/packages/Fermata
License: MIT License
An F# helper library for working with values of basic types in F#. Compatible with Fable.
Home Page: https://www.nuget.org/packages/Fermata
License: MIT License
F# codes have to be included in a package so that the package can work in a Fable project.
A code formatter is needed.
Testing is important!
List/Array/Seq.intersection has an issue related to constraints. It can be fixed by adding when 'T: equality
.
Arb
is a module for radix conversion with an arbitrary radix.
Arb
is also a name of a discriminated union to represent the converted number.
The module provides functions for conversion, such as ofInt
and toInt
.
.NET static methods Int32.Parse
and Int32.TryParse
are useful. But when it comes to using with Result
type, there can be a function that validate a number and returns Result<int, 'Error>
.
Dec
in Fermata.RadixConversion
module deals with values of type int32, so it should be renamed Dec32
to show that it can't have a value greater than Int32.MaxValue
or less than Int32.MinValue
.
For the same reason, Bin
should be Bin32
, and Hex
should be Hex32
.
Now Fermata cannot be loaded in a Fable project correctly, which might be caused by lacking .fsi
files.
Now error handling is done with discriminated unions.
But exception
is more useful for some reasons:
exception
can be used in the same way as UD.exception
can stop the program running.So replace UD with exception
and use them. They can be thrown or they can't.
There are some incorrect lines.
Fermata.Errors.Errors
though it returns exn
.Dec.tryToBin
is called in an example for Dec.tryToHex
.Dec.tryToBin
is called in an example for Dec.tryToHex
.Fermata.Errors.Errors
though it returns exn
.Fermata.Errors.Errors
though it returns exn
.Now the validate
functions for those modules don't see the length of the input strings, which leads to overflow.
So those functions should have length validation.
<Version>
in .fsproj
.<Version>
in .fsproj
.<Description>
in .fsproj
so viewers can see its purpose quickly.intersection
function in Fermata.Array
, Fermata.List
andFermata.Seq
modules should be renamed after Set.intersect
.
Validation functions are to be named according to following rules:
validate
function returns Result
or Option
isValid
function returns bool
So following actions are needed:
validate
to isValid
validate
tryToXxx
functions<OtherFlags>--allsigs</OtherFlags>
to .fsproj
, a compiler option to generate a signature file for each source file.dotnet build
to generate signature files..fsproj
.<OtherFlags>--allsigs</OtherFlags>
from .fsproj
because the option overwrote signature files I wrote on build!<Copyright>
<RepositoryUrl>
<RepositoryType>
This project is listed in Sergey Tihon's F# Weekly newsletter like this:
taidalog/Fermata: F# miscellaneous library
Could the Fermata's About section be specified a bit more so viewers can see its purpose quickly?
Dec
, Bin
and Hex
are represented as type of int
or string
. However, in this way, incorrect values can get into processing. In order to avoid it, there should be DUs for those types of numbers.
A code formatter is needed.
There are some incorrect lines.
Fermata.Errors.Errors
though it returns exn
.Fermata.Errors.Errors
though it returns exn
.Fermata.Errors.Errors
though it returns exn
.Fermata.Errors.Errors
though it returns exn
.Fermata.Errors.Errors
though it returns exn
.Fermata.Errors.Errors
though it returns exn
.Commonly used validation functions should be given as a module.
Following functions are used often.
Some modules with common names such as List
, Array
or Seq
should be given [<RequireQualifiedAccess>]
attribute to avoid name collisions between other modules.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.