Stack Exchange
A method-local type alias
In the following code you can see some daunting repetitive typing:
implicit def intEqualInstance
  [ root,
    path <: TypePath[root] ]
  ( implicit mappingResolver: rel.rules.MappingResolver[path] )
  = {
    new genExp.Compiler
      [ genExp.templates.Where.Comparison[root, path, genExp.templates.Operator.Equal, typeLevel.Bool],
        genExp.values.Where.Comparison[ genExp.values.Expression.Value[ Int ] ],
        relExp.templates.Where,
        List[rel.Value] ]
      {
        override def compileTemplate(tpl: genExp.templates.Where.Comparison[root, path, genExp.templates.Operator.Equal, typeLevel.Bool]) = {
          ...
        }
        override def processValues(vals: genExp.values.Where.Comparison[ genExp.values.Expression.Value[ Int ] ]) = {
          ...
        }
      }
  }

I want to declare type aliases for the repeated types.
I've tried adding subtype constraints as in the following, but it makes the implicit resolution fail:
implicit def intEqualInstance
  [ ...,
    inputTemplate <: genExp.templates.Where.Comparison[root, path, genExp.templates.Operator.Equal, typeLevel.Bool],
    inputValues <: genExp.values.Where.Comparison[ genExp.values.Expression.Value[ Int ] ] ]
  ( implicit mappingResolver: rel.rules.MappingResolver[path] )
  = {
    new genExp.Compiler
      [ inputTemplate, 
        inputValues, 
        ... ]
      {
        override def compileTemplate(tpl: inputTemplate) = ...
        override def processValues(vals: inputValues) = ...
      }
      ...

Adding local type aliases, makes the implicit resolution fail too:
implicit def intEqualInstance
  ...
  = {
    type InputTemplate = genExp.templates.Where.Comparison[root, path, genExp.templates.Operator.Equal, typeLevel.Bool]
    type InputValues = genExp.values.Where.Comparison[ genExp.values.Expression.Value[ Int ] ]
    new genExp.Compiler
      [ InputTemplate
        InputValues,
        ... ]
      ...

Is there any solution for this?

The best I could come up with was to declare type aliases in the outer scope:
private type InputTemplate[root, path <: TypePath[root]] = 
  genExp.templates.Where.Comparison[root, path, genExp.templates.Operator.Equal, typeLevel.Bool]
private type InputValues = 
  genExp.values.Where.Comparison[ genExp.values.Expression.Value[ Int ] ]

implicit def intEqualInstance
  [ root, path <: TypePath[root] ]
  ( implicit mappingResolver: rel.rules.MappingResolver[path] )
  =
  new genExp.Compiler
    [ InputTemplate[root, path], InputValues, ... ]
    {
      override def compileTemplate(tpl: InputTemplate[root, path]) = ...
      override def processValues(vals: InputValues) = ...
    }


you can define aliases in some object (to restrict their scope) and then import this object's aliases inside the method: def foo { import AliasesHolder._ ... }

@om-nom-nom I don't think so, since the locally the aliases declared in function body didn't work out, and what's the difference.

Yeah, misunderstood the problem
