[Haskell-cafe] Design Question - Functions taking 'subtype' like arguments but has to be restricted to one type
Imants Cekusins
imantc at gmail.com
Sun Jul 31 13:53:34 UTC 2016
Beware: if you go with Either and combine Either ops with >>=, first Left
result stops evaluation and returns 1st Left result. Right results continue
evaluation. If this is expected, Either fits.
If more ops are expected after 'update count' no-op (if Left stands for
Frozen), then Either and >>= should not be used together.
Algebraic type (Flex count | Frozen count) is also suitable. Let the
calling functions decide how to process Frozen values. At least they'll
know the difference.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20160731/1f5bbb82/attachment.html>
More information about the Haskell-Cafe
mailing list