lean4-htt/src/Lean/Data/OpenDecl.lean
Markus Himmel 9402c307fe
chore: reorganize Init imports around strings (#10289)
This PR reorganizes the import hierarchy so that
`Init.Data.String.Basic` can import `Init.Data.UInt.Bitwise` and
`Init.Data.Array.Lemmas`.
2025-09-07 17:09:14 +00:00

38 lines
933 B
Text

/-
Copyright (c) 2020 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Leonardo de Moura
-/
module
prelude
public import Init.Meta
public import Init.Data.String.Basic
public import Init.Data.ToString.Name
public section
namespace Lean
/-- Data for representing `open` commands -/
inductive OpenDecl where
| simple (ns : Name) (except : List Name)
| explicit (id : Name) (declName : Name)
deriving BEq
namespace OpenDecl
instance : Inhabited OpenDecl := ⟨simple Name.anonymous []⟩
instance : ToString OpenDecl := ⟨fun decl =>
match decl with
| explicit id decl => toString id ++ " → " ++ toString decl
| simple ns ex => toString ns ++ (if ex == [] then "" else " hiding " ++ toString ex)⟩
end OpenDecl
def rootNamespace := `_root_
def removeRoot (n : Name) : Name :=
n.replacePrefix rootNamespace Name.anonymous
end Lean