Removing MonadFail from Monad
Andreas Abel
andreas.abel at ifi.lmu.de
Tue Dec 17 09:53:21 UTC 2013
On 17.12.2013 00:32, Roman Cheplyaka wrote:
> * David Luposchainsky <dluposchainsky at googlemail.com> [2013-12-16 23:57:19+0100]
>>> 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?
>
> One notable case of one-constructor types defined not via data is
> tuples. You certainly don't want warnings for that!
Should not tuple types be understood as
data (,) a b = (,) a b
data (,,) a b c = (,,) a b c
making them one-constructor types?!
> Regarding newtypes vs data, I'm not so sure it should make a difference.
> It's customary to make one-field types newtypes, and then, if one
> realizes that more fields are needed, turn them into proper data types.
I agree. What operational semantics is concerned (this mean the
execution model of Haskell in the programmer's mind),
newtype = data
Cheers,
Andreas
--
Andreas Abel <>< Du bist der geliebte Mensch.
More information about the Libraries
mailing list