Closed
Description
Latest release redefined StandardVersion
as:
data StandardVersion
= NoVersion
| V_5_0_0
| V_4_0_0
| V_3_0_0
| V_2_0_0
| V_1_0_0
deriving (Enum, Bounded)
defaultStandardVersion :: StandardVersion
defaultStandardVersion = NoVersion
Unfortunately, with this definition it is not possible to get latest supported version, of the standard, in a nice way. The dhall
command fails victim to this as well:
⊢ dhall version
Haskell package version: 1.21.0
Standard version: none
My first reaction after seeing that there is a Bounded
instance available was to use maxBound :: StandardVersion
. Unfortunately that doesn't work as expected due to ordering of data constructors:
>>> renderStandardVersion (maxBound :: StandardVersion)
"1.0.0"
These are possible solutions that I came up with:
- Reorder data constructors to get expected behaviour from
Enum
andBounded
instances. - Define
Enum
andBounded
instances manually. - Introduce
latestSupportedStandardVersion :: StandardVersion
that would, at the moment, point toV_5_0_0
.
I'm happy to help with the implementation as well.