
Hey Andreas, On 16.12.2013 23:39, Andreas Abel wrote:
"Only one data constructor" should be understood hereditarily; the description is not entirely accurate:
-- Only one data constructor: do not add MonadFail constraint do (Only x) <- computation >>> let f (Only x) = more more >>> in computation >>= f
(Only x) should be pat such that every constructor in pat is an "only-one" constructor.
Do you mean in case patterns of nested "Only" types appear, like `Only (Only' x)`? I hadn't thought of that, good point.
- The case of one data constructor should emit a warning if the data type is defined via `data`: adding another data constructor can make patterns in unrelated modules refutable.
I don't understand the restriction "is defined via data" since I am not aware of defining constructors outside of data or with something other than the data keyword. Please clarify.
I meant "data and not newtype". If "Only" is a newtype data constructor, the pattern is irrefutable by design, is it not? Greetings, David/quchen