CC: [EMAIL PROTECTED]
But the problem is that I need the type name c inside the body of the
function! I'm assuming always that I can solve a typeing problem by
adding an explicit type signature wherever it's needed; however, that
implies that I need to be able to get at the type names.
----------
From: mpj
Sent: 22 July 1998 14:44
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: Scoped typed variables.
| Yes, I've always tended to think that the parameters of a function need
| to be given types explicity.
I'm not sure I'd want to go as far as this as I think it could become
quite a burden. I'm only expecting the types-on-the-left-hand-side
syntax to be used occasionally. Most of the time, I prefer to write
separate type declarations for top-level functions so that they can be
understood independently of the function's definition.
| Simon missed one interesting line from my
| example -- something is needed to specify the context in a form that
| makes it usable within the body of the function. How about this:
|
| (Num c) =>
| (f (xs::[a]))::c =
| ...
I don't actually see why it should be *needed*. From the perspective of
what the type checker needs to do, it certainly isn't necessary. From
the perspective of a programmer who wants to document what their program
does, there is perhaps more motivation. But that can be done with an
explicit type signature instead: f :: Num c => [a] -> c.
All the best,
Mark