[Types-sig] Type annotations

Martijn Faassen faassen@vet.uu.nl
Fri, 17 Dec 1999 19:10:05 +0100


Tim Peters wrote:
> BTW, Python's actual "map" function is quite a puzzle to describe!  I can't
> do it:
> 
>     map: def(def(_A)->_B, Seq(_A) -> [_B] |
>          def(def(_A, _B)->_C, Seq(_A), Seq(_B)) -> [_C] | ...
> 
> is just the start of an unbounded sequence of legit map signatures.  Haskell
> avoids the difficulty here thanks to currying.

I can't do it either, but for the simple version of the function, isn't
this more readable (I already notice a typo involving a closeing ) in yours!):

# another variety on my proposal presented here :)
decl: 
    typedef Func(_A):
        return _B

decl:
    typedef map(Func(_A, _B), [_A]):
        return [_B]
    actualmap = map(_A=int, _B=string)

But perhaps it's just a matter of getting used to things.

Regards,

Martijn