[Haskell-beginners] Parser using the show method

Francesco Ariis fa-ml at ariis.it
Fri Jun 21 13:08:54 UTC 2019


On Fri, Jun 21, 2019 at 01:02:26PM +0000, PICCA Frederic-Emmanuel wrote:
> Re-Hello,
> 
> is there a way to apply a function to all constructors of this  this type ?
> 
> Instead of doing this ?
> 
> do         sg P1
>             sg P2
>             sg P21
> [...]

Use the same `Enum` trick Tobias Brandt described.

    λ> :t sequence_ $ map print [FirstConstructor ..]


More information about the Beginners mailing list