There are lots of things I like about F#. Probably one that is unique though is its computation expressions. Here is a list example.
// a list normally is defined like this: [ 1; 2; 3 ]
let validate course =
// but the compiler knows this is a CE
// because we put logic in it
if isBlankish course.Name then
yield "Course Name blank"
match course.Exam with
| None -> () // do nothing
| Some exam ->
yield! Exam.validate exam
// the ! is for other lists, flattens
// errors : string list
let errors = validate course
This provides a list of errors. And it is composable with other validations. It could be called in the same way that this function calls Exam.validate.
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.