Closed davidchambers closed 5 years ago
I think this is a good change.
try/catch
is more suited to Either than Maybe anyway.
The change is useful. However, typescript @types/sanctuary need related updates too.
import S = require("sanctuary"); {} import which = require("which"); undefined var adb = S.encase(which.sync)("adb"); undefined S.type(adb); { namespace: Just ("sanctuary-either"), name: 'Either', version: 1 } adb.value [eval].ts:5:5 - error TS2339: Property 'value' does not exist on type 'Maybe
'. 5 adb.value undefined
There's little value in having both
S.encase
andS.encaseEither
: every use of the former could be rewritten in terms of the latter with help fromS.eitherToMaybe
. Thus we should removeS.encase
.This vacates the desirable name, so we should then rename
S.encaseEither
.Finally, we should drop the
Error -> l
argument as it is unnecessary in the presence ofS.mapLeft
.In summary:
In conjunction with #618, this will reduce the number of “encase” functions from six to one. :)