
27 Oct
2010
27 Oct
'10
7:57 p.m.
| Drifting off-topic, but wouldn't we want to be able to use similar | syntax to bind types too? e.g. | | f ((Just @ t) x) = (Right @ String @ t) x | | but @ is unavailable in patterns. Oh yes, good point. It'd be particularly useful in existential patterns: data T where MkT :: forall a. a -> (a -> Int) -> T f (MkT @ a x g) = g (x::a) The idea is that the pattern (MkT @ a x g) brings the type variable 'a' into scope. As you point out, though, '@' is already used in patterns, but perhaps this use is unambiguous. Confusing though f (MkS @ a x@(p,q) z) = .... Maybe someone else can think of good syntax. Simon