Pattern Matching to Null Typed Objects

The standard pattern matching objects are not designed to handle objects with the Null type. There are pattern matching objects designed to allow you to match to Null typed objects.

If any term on the right-hand side of a clause builds to a Null typed expression, the entire right-hand side will normally reduce to just that expression. If the Null typed expression is the null object, processing will fall through to the next clause in the function. For any other Null typed expression, that expression will become the return value of the function.

If a Null typed expression appears inside of the match terms it's handled the same way that it's handled on the right-hand side of a clause. It's becomes the returned value of the clause.

For example, if Fn[x] returns the Exception object (which is a Null typed expression) then this clause:

{ Fn[x] -> pattern } => expr

will return Exception.