The `rand(dist, n::Int)`

method is really handy, but there’s a lot of irregularity in the type that’s returned. Ideally we’d have some type `A`

with

```
typeof(rand(dist, n::Int)) == A{typeof(rand(dist)), n}
```

Having an identity like this at the type level can allow us to build very general code, rather than relying no special cases. The obvious choice here is `A == Array`

, but this loses some efficiency; for example, a regular array-of-vectors is more efficiently stored as a Matrix.

Currently, the relation is not a type constructor, but a *function*, something like

```
typeof(rand(dist, n::Int)) == f(typeof(rand(dist)), n)
f(Array{T, n}) = Array{T, n+1}
f(T) = Vector{T}
```

RecursiveArrayTools.jl gives a way to treat, for example, a vector-of-vectors as a matrix. It seems in the above case we need something to go the other direction, allowing internal representation as a regular array, but indexing as nested arrays.

Or maybe this is entirely wrong, and we need a different approach. Any ideas?