Datatype Constructors: selector/matcher vs builder 'function'

Anthony Clayden anthony.d.clayden at gmail.com
Tue Oct 5 00:36:25 UTC 2021


>From this discussion 'Contexts on datatype declarations'
http://web.archive.org/web/20151208175102/http://code.haskell.org/~dons/haskell-1990-2000/threads.html#04062

It looks like (at least at the time) GHC had separate functions for
matching vs building using a constructor.

In Hugs, the type for a datatype's constructor(s) is inferred in static.c
routine selectCtxt( ) called from depConstrs( ).

The type for field (label) selectors is inferred in type.c routine typeSel(
). And it's easy enough to hack that to drop the preds on the selectors, as
SPJ advocates in that thread.

What I can't find is where Hugs infers the type for a data constructor
appearing in matching position.

Any hints?  Thanks in advance

AntC
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/hugs-bugs/attachments/20211005/1a50df13/attachment.html>


More information about the Hugs-Bugs mailing list