From 1b56b31e809efb930a67ce6795323f0bbc0ab4ec Mon Sep 17 00:00:00 2001 From: Gary Verhaegen Date: Thu, 25 Feb 2021 10:33:52 +0100 Subject: [PATCH] document potentially-surprising Month <-> Enum (#8923) Based on a [forum question] by Alxander Bernauer. [forum question]: https://discuss.daml.com/t/enum-instance-for-month-is-misleading/2098?u=gary_verhaegen CHANGELOG_BEGIN CHANGELOG_END --- compiler/damlc/daml-stdlib-src/DA/Date/Types.daml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/compiler/damlc/daml-stdlib-src/DA/Date/Types.daml b/compiler/damlc/daml-stdlib-src/DA/Date/Types.daml index 8ebb8a9c55d..c8da10fd713 100644 --- a/compiler/damlc/daml-stdlib-src/DA/Date/Types.daml +++ b/compiler/damlc/daml-stdlib-src/DA/Date/Types.daml @@ -17,6 +17,9 @@ data DayOfWeek | Sunday -- | The `Month` type represents a month in the Gregorian calendar. +-- +-- Note that, while `Month` has an `Enum` instance, the `toEnum` and `fromEnum` +-- functions start counting at 0, i.e. `toEnum 1 :: Month` is `Feb`. data Month = Jan | Feb