[Haskell-cafe] Constraints as a moveable feast?
anthony_clayden at clear.net.nz
Thu Sep 10 06:18:42 UTC 2020
> On *Tue Sep 1 21:18:40 UTC 2020, ** Richard Eisenberg wrote:*
*> *I see the core idea as a fairly straightforward generalization of the
"Partial Type Constructors" work
Ah. Now I see a bit more of what you're getting at. We want as if the
type synonym were an associated type family with a most-general
class Num a => CPoint a where
type Point a
instance Num a => CPoint a where
type Point a = (a, a)
The semantics to be as the PTC paper, such that expanding `Point a`
always requires a `CPoint a` instance, which will in turn want a `Num
And the expansion to be immediate (as with type synonyms) so that the
client can put `Point a` in instance heads, for example.
> But I really don't know what it means to expand without adding parens. ... what about
> *pointX :: Point a -> a*
*> ... *We don't want that type to expand to (Num a => (a, a)) -> a
Ok, it was your using fancy type operators that put me off. We can
represent the AST (and show the need for parens) by reverting to
prefix syntax, within H98:
pointX :: (->) (Point a) a -- needs parens around (Point a)
And yes my naieve syntactic expansion would give the type you show,
wot we do not want.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe