[Haskell-cafe] Ensuring all values of an ADT are explicitly handled OR finding all occurrences of type X in my app
Branimir Maksimovic
branimir.maksimovic at gmail.com
Tue Jan 31 05:10:56 UTC 2017
Actually in team, one who writes `_` match, is very useful as that
prevents breaking code when adding new value...
I can't really see any problem here. There is real world use case when
member of team don't need to cover all cases therefore `_`.
On 01/31/2017 05:59 AM, Saurabh Nanda wrote:
> I would want the compiler (or linter) to help me here. Think if a
> mid-to-large team where everyone may not know (or remember) what the
> current best practices are.
>
> On 31 Jan 2017 9:51 am, "Michael Orlitzky" <michael at orlitzky.com
> <mailto:michael at orlitzky.com>> wrote:
>
> On 01/30/2017 09:47 PM, Saurabh Nanda wrote:
> > Hi,
> >
> > If I have the following ADT
> >
> > data BookingState = Confirmed | Cancelled
> >
> > which had a very high chance of being expanded in the future to
> have more
> > values. How do I ensure that every pattern match on BookingState
> matches
> > each value explicitly. Basically prevent the '_' matcher ?
> >
>
> Don't write the "_" case? GHC will warn you about any pattern matches
> you've missed.
>
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> <http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe>
> Only members subscribed via the mailman list are allowed to post.
>
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20170131/dfcdf748/attachment.html>
More information about the Haskell-Cafe
mailing list