Question: When you create a case class, the compiler creates a corresponding companion object with a few of the case class goodies: an `apply` factory method matching the primary constructor, `equals`, `hashCode`, and `copy`.

Somewhat oddly, this generated object extends FunctionN.

```
scala> case class A(a: Int)                                 
defined class A

scala> A: (Int => A)
res0: (Int) => A = <function1>

```

This is only the case if: 

* There is no manually defined companion object
* There is exactly one parameter list
* There are no type arguments
* The case class isn't abstract.

Seems like this was [added](https://lampsvn.epfl.ch/trac/scala/changeset/13719) about two years ago. The latest incarnation is [here](https://lampsvn.epfl.ch/trac/scala/browser/scala/trunk/src/compiler/scala/tools/nsc/typechecker/Unapplies.scala?rev=21944#L136).

Does anyone use this, or know why it was added? It increases the size of the generated bytecode a little with static forwarder methods, and shows up in the `#toString()` method of the companion objects:

```
scala> case class A()
defined class A

scala> A.toString
res12: java.lang.String = <function0>

```

**UPDATE**

Manually created objects with a single `apply` method are not automatically considered as `FunctionN`:

```
object HasApply {
  def apply(a: Int) = 1
}
val i = HasApply(1)

// fails
//  HasApply: (Int => Int) 

```

Answer: 
Aside from oxbow\_lakes's reply about the naturalness of it, it can often be useful to have constructors available as first-class functions, particularly in conjunction with Scala collections higher-order functions. For (a trivial) example,

```
scala> case class Foo(i : Int)
defined class Foo

scala> List(1, 2, 3) map Foo   
res0: List[Foo] = List(Foo(1), Foo(2), Foo(3))

```
```
Welcome to Scala version 2.8.0.RC3 (Java HotSpot(TM) Client VM, Java 1.6.0_20).

scala> case class CC3(i: Int, b: Boolean, s: String)
defined class CC3

scala> CC3
res0: CC3.type = <function3>

scala> CC3.apply(1, true, "boo!")
res1: CC3 = CC3(1,true,boo!)

scala> CC3(1, true, "boo!")
res2: CC3 = CC3(1,true,boo!)

```