It’s sometimes useful to define a data type locally. This is often useful for similar reasons to why a local function declaration is useful. It naturally limits the scope of the type, so the programmer doesn’t need to worry about where-else the type can escape to.

Most modern programming languages provide some version of this though often with limitations (e.g. no protocols / types can’t escape their scope), e.g.

// this is semantic gibberish, but shows a use example
func f() {
  struct Proxy {}
  func bar() -> Proxy {
    print("hello")
    return proxy
  }
  let x = bar()
  return
}

This goes well with scoped typeclasses or implicits in contexts where confluent instance resolution is important.

See also this GHC proposal.