A Pointless Library Proposal
ctm at cs.nott.ac.uk
Wed Oct 25 04:18:28 EDT 2006
Russell O'Connor wrote:
> Samuel Bronson <naesten <at> gmail.com> writes:
>> On 10/24/06, Russell O'Connor <roconnor <at> theorem.ca> wrote:
>>> Why have a function body at all? Shouldn't the type signature be sufficent?
>> Remember that type signatures need not be adjacent to function
>> definitions. Now ponder what would happen if you forgot to define a
>> function. Have a clue why it isn't sufficient now?
> If you turn on -Wall in GHC, you would get a warning that your pattern coverage
> is incomplete. We should make it so that if the pattern coverage is incomplete
> and there is no function body, then that is an error.
So, taking Void to be the colour of the empty bikeshed and
avoid :: Void -> x
suppose I define
data WrapVoid = Wrap Void
may I now write
boo :: WrapVoid -> x
with no equations? Does this cover? Or does it neglect the crucial boo
(Wrap _|_) case?
hoo :: Void -> Bool -> x
? Does this cover, or did I forget hoo v True and hoo v False?
Funny business, coverage checking. With GADTs, things become even more
All the best
More information about the Libraries