ephemera@lemmy.blahaj.zone to Programming@programming.devEnglish · 4 days agoParse, don’t validatelexi-lambda.github.ioexternal-linkmessage-square10fedilinkarrow-up152arrow-down11cross-posted to: programming@programming.dev
arrow-up151arrow-down1external-linkParse, don’t validatelexi-lambda.github.ioephemera@lemmy.blahaj.zone to Programming@programming.devEnglish · 4 days agomessage-square10fedilinkcross-posted to: programming@programming.dev
minus-squareKache@lemm.eelinkfedilinkarrow-up2·3 days agoYou cannot, and that’s why that type declaration models a NonEmpty that a type checker can enforce
minus-squareonlinepersona@programming.devlinkfedilinkEnglisharrow-up2·3 days agoSo it’s the implementation that has to ensure a NonEmpty is returned, but that’s up to the developer, correct? The developer still holds the gun to shoot themselves in the foot by returning an empty list, IINM. Anti Commercial-AI license
You cannot, and that’s why that type declaration models a
NonEmpty
that a type checker can enforceSo it’s the implementation that has to ensure a
NonEmpty
is returned, but that’s up to the developer, correct? The developer still holds the gun to shoot themselves in the foot by returning an empty list, IINM.Anti Commercial-AI license