- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
Why is flatten declared on GenericTraversableTemplate and not TraversableLike
Fri, 2009-11-27, 15:57
I asked this on StackOverflow but it had no response. (http://stackoverflow.com/questions/1802828/why-is-flatten-declared-on-ge...).
The signature of
Chris
Use Hotmail to send and receive mail from your different email accounts. Find out how.
The signature of
TraversableLike.flatMap
is as follows:def flatMap[B, Th](f : (A) => Traversable[B])(implicit bf : CanBuildFrom[Repr, B, Th]) : Th
The signature of GenericTraversableTemplate.flatten
is:def flatten[B](implicit asTraversable : (A) => Traversable[B]) : CC[B]
Why is the latter method (which seems to me to differ in usage from flatMap
only in the sense that the transformer function is implicit
) not definable on TraversableLike
as:def flatten[B, Th](implicit asTraversable: (A) => Traversable[B],
implicit bf : CanBuildFrom[Repr, B, Th]) : Th
Is there some reason that this must be the case?Chris
Use Hotmail to send and receive mail from your different email accounts. Find out how.
Fri, 2009-11-27, 18:37
#2
Re: Why is flatten declared on GenericTraversableTemplate and
Indeed, by analogy to flatMap, this might be a better signature (&implementation) for flatten in TraversableLike:
def flatten[B](implicit asTraversable: A => Traversable[B], bf: CanBuildFrom[Repr, B, That]): That = flatMap(asTraversable)
If no-one objects, I'll remove the old flatten implementation and move this one-liner to TraversableLike
cheers
adriaan
def flatten[B](implicit asTraversable: A => Traversable[B], bf: CanBuildFrom[Repr, B, That]): That = flatMap(asTraversable)
If no-one objects, I'll remove the old flatten implementation and move this one-liner to TraversableLike
cheers
adriaan
From: oxbow_lakes@hotmail.com
To: scala-internals@listes.epfl.ch
Subject: [scala-internals] Why is flatten declared on GenericTraversableTemplate and not TraversableLike
Date: Fri, 27 Nov 2009 14:57:27 +0000
.ExternalClass .ecxhmmessage P {padding:0px;} .ExternalClass body.ecxhmmessage {font-size:10pt;font-family:Verdana;} I asked this on StackOverflow but it had no response. (http://stackoverflow.com/questions/1802828/why-is-flatten-declared-on-ge...).
The signature of
TraversableLike.flatMap
is as follows:The signature of
GenericTraversableTemplate.flatten
is:Why is the latter method (which seems to me to differ in usage from
flatMap
only in the sense that the transformer function isimplicit
) not definable onTraversableLike
as:Is there some reason that this must be the case?
Chris
Use Hotmail to send and receive mail from your different email accounts. Find out how.
New! Receive and respond to mail from other email accounts from within Hotmail Find out how.