[Haskell-cafe] Re: [Haskell] View patterns in GHC: Requestforfeedback

Dan Licata drl at cs.cmu.edu
Mon Jul 30 06:28:40 EDT 2007


On Jul30, Claus Reinke wrote:
> >>one could turn that promise into a type-checked guarantee by using
> >>explicit sum types (and thus structural rather than name-based typing),
> >>but that gets awkward in plain haskell.
> >
> >I don't think the choice of whether you label your variants with names
> >or with numbers (in1, in2, in3...) has anything to do with the choice of
> >whether you require your cases to be exhaustive or not.
> 
> i was talking about name-based (as in: this is the sum type named List) 
> vs structural (as in: this is the sum type build from Cons and Nil) typing.
> the former hides (in-)exhaustiveness from the type system, the latter
> exposes it. 
> 

I don't think the juxtaposition you're setting up here, between
"name-based" and "structural", is correct.  You could just as well
choose the elimination form for "name-based" sum types (i.e., datatypes)
to be an exhaustive case analysis.  It just happens that Haskell chooses
to permit non-exhaustive case expressions.  

-Dan


More information about the Haskell-Cafe mailing list