partial type signatures/annotations/declarations..
Claus Reinke
claus.reinke at talk21.com
Sat Mar 4 14:36:17 EST 2006
when trying to look up the state of this proposal, I noticed:
- there seem to be two parallel versions (probably signatures
is an older form, and all references ought to point to annotations
instead?):
http://hackage.haskell.org/trac/haskell-prime/wiki/HaskellExtensions
points to:
http://hackage.haskell.org/trac/haskell-prime/wiki/PartialTypeSigs
http://hackage.haskell.org/trac/haskell-prime/ticket/40
whereas
http://hackage.haskell.org/trac/haskell-prime/report/9
points to:
http://hackage.haskell.org/trac/haskell-prime/wiki/PartialTypeAnnotations
http://hackage.haskell.org/trac/haskell-prime/ticket/86
- the proposal focusses on using "_" as a place holder for unspecified
parts of a type or context, without discussing the alternative I'd favour:
instead of introducing holes in types and contexts to leave
parts of a declaration unspecified, why not use type subsumption?
the idea being, that instead of declaring the precise type, one
would declare an upper bound on the type, and the precise type
inferred needs to be subsumed by the one declared. type and
context syntax would remain unchanged, but in addition to "::"
for precise type annotations, there'd be ":::" (or "::<", or whatever)
to indicate the difference in intended semantics.
pro: would easily allow for omission of type details or parts
of context (a type with more context, or with more specific
type components, is subsumed by the declaration)
cons: as long as we only specify an upper bound, the inferred
type could be more specific than we'd like (we can't say
that we don't want context, or that some type variable
must not be instantiated)
cheers,
claus
More information about the Haskell-prime
mailing list