type equality symbol
isaacdupree at charter.net
Wed Dec 5 19:20:41 EST 2007
Manuel M T Chakravarty wrote:
> Simon Peyton-Jones:
>> Nothing deep. Just that "=" means so many things that it seemed
>> better to use a different notation.
> Also, using "=" would have entailed significant changes to GHC's
> parser. Type constraints are in the same syntactic category as types
> and types can appear as part of expressions in type annotations (such as
> "e::t") and on the lhs of let-bindings (such as "let x::t = e in e'").
> Especially, considering the later, imagine "t" can now also contain the
> symbol "=" which in the grammar serves as a separator between the lhs
> and the rhs of a let bindings.
> I actually did try using "=", but it got too messy.
oh, because it doesn't require parentheses:
f :: a ~ b => a -> b
f = id
and also because, it sounds like you say, current parser looks at
"type-class" and "type" expressions the same, so one doesn't really want
to distinguish them just for this.
x :: a = b => c = x
really is too confusing, even if I can't see any way to make it
ambiguous given current set of available language extensions.
More information about the Glasgow-haskell-users