addRoot :: Var.Home -> String -> JS.Expression ()
addRoot home name =
  case home of
    Var.Local ->
        JS.ref name

    Var.TopLevel _moduleName ->
        JS.ref name

    Var.BuiltIn ->
        JS.ref name

    Var.Module (ModuleName.Canonical _ moduleName) ->
        JS.DotRef () (JS.ref (modulePrefix moduleName)) (JS.Id () name)
addRoot :: Var.Home -> String -> JS.Expression ()
addRoot home name =
  case home of
    Var.Local ->
        JS.ref name

    Var.TopLevel _moduleName ->
        JS.ref name

    Var.BuiltIn ->
        JS.ref name

    Var.Module (ModuleName.Canonical _ moduleName) ->
        JS.DotRef () (JS.ref (modulePrefix moduleName)) (JS.Id () name)
addRoot home name =
  case home of
    Var.Local ->
        JS.ref name

    Var.TopLevel _moduleName ->
        JS.ref name

    Var.BuiltIn ->
        JS.ref name

    Var.Module (ModuleName.Canonical _ moduleName) ->
        JS.DotRef () (JS.ref (modulePrefix moduleName)) (JS.Id () name)