[Haskell-cafe] How to create a list of each constructor value

Henning Thielemann lemming at henning-thielemann.de
Wed Nov 30 15:21:53 UTC 2022


On Wed, 30 Nov 2022, PICCA Frederic-Emmanuel wrote:

> Hello, I have a type like this
>
> data InputType = CristalK6C
>               | MarsFlyscan
>               | MarsSbs
>               | SixsFlyMedH
>               | SixsFlyMedV
>               | SixsFlyMedVEiger
>               | SixsFlyMedVS70
>               | SixsFlyScanUhv
>               | SixsFlyScanUhv2
>               | SixsFlyScanUhvTest
>               | SixsFlyScanUhvUfxc
>               | SixsSbsFixedDetector
>               | SixsSbsMedH
>               | SixsSbsMedV
>               | SixsSbsMedVFixDetector
>  deriving (Eq, Show)
>
> I want to create a list of each values in order to create meaningfull 
> error message for the user and simplify my Arbitrary instances.

deriving (Enum, Bounded)


then use [minBound .. maxBound]


More information about the Haskell-Cafe mailing list