Re: ghc should be able to deduce correct use of partial functions and not give a warning in such cases

Anthony Clayden <[email protected]>
Newsgroups gmane.comp.lang.haskell.cafe
Message-ID <CABU_mxinBCRNzjEB-+VMtpO7A5mOBdHj4s7F=1JL3ensvcMXsA@mail.gmail.com>
>
> So your code is essentially pattern matching on a list to decide ...,
then pattern matching on the Bool to split between two cases, then pattern
matching on the list again. If you had kept the result of the first pattern
match there would be no need for the latter two.
>
> Essentially the problem is "boolean blindness" ...
>
> This style of coding is generally more readable, maintainable, and less
error-prone. ...
>


+1 to Ben's wise advice. +1 to "more readable". Haskell is a 'functional
language' does not mean everything everywhere has to be expressed only
through functions.

Perhaps we should promote 'Algebraic data types' (yay mathy!) and 'pattern
matching' right up front on the 'Features' section of Haskell.org?


AntC

_______________________________________________
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.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.