"Peter Alexander" <peter.alexander...@gmail.com> wrote in message news:j5dhe0$2ln6$1...@digitalmars.com... > > For example, in Haskell, map (correctly) has the signature: > > map :: (a -> b) -> [a] -> [b] > > but in D, std.map has the signature (expressed in some Haskell/D > pseudocode) > > map :: (a -> b) -> [a] -> Map!((a -> b), [a]) >
That actually brings up something I've found kind of interesting about D's map and other similar functions. They return a type that's specially-tasked as "the return type for function {whatever}". So, in a way, it seems almost like saying: ReturnTypeOf!(foo) foo() {...} Ie, "The return type of this function is defined to be the type this function returns." Of course, I realize that's not actually what's going on.