Skip to content

Releases: lubieowoce/sumtype

Constant variants

14 Oct 20:03
e21db3a
Compare
Choose a tag to compare
Constant variants Pre-release
Pre-release

We only ever need one None, (), etc. After this update, variants with no payload (i.e. Nothing from Maybe[A]) can behave that way: we do Maybe.Nothing (access the singleton immutable value) instead of Maybe.Nothing() (create a new instance). This is enabled with the new constants option:

class Maybe(sumtype, constants=True):
def Just(val): ... 
Nothing =# new syntax

or by inheriting from sumtype.future.sumtype instead of sumtype.sumtype (This will be the default behavior after 1.0).

Note: it isn't currently guaranteed that there only ever exists one Maybe.Nothing - currently, _replace(), .__copy__() etc. will produce another instance, so you shouldn't rely on the is operator. This may or may not change in the future.

Added typechecking

18 Sep 15:47
Compare
Choose a tag to compare

Fixed code-block indentation in the README, because it looked bad on PyPI

Added typechecking

16 Sep 20:31
Compare
Choose a tag to compare

Fixed typo in README

Added Typechecking

16 Sep 15:32
Compare
Choose a tag to compare

Added missing typeguard dependency to setup.py

Added Typechecking

16 Sep 14:53
Compare
Choose a tag to compare

Added field typechecking based on annotations (see README)