- Type (
Type
)- Regular
- Generic
inductive
structure
def
|abbrev
- Subtype
def
|abbrev
- Specialization (concrete type of a type family)
- Examples
abbrev Point := Nat × Nat
- Examples
- Generic
- Field of a regular structure
- Regular
- Typeclass (
Class
) - Typeclass instance (
Instance
) - Function on a type (
Fun
) - Coercion (
Coe
) - Data (
Data
) - Theorem (
Theorem
) - Macro (
Macro
) - Other (
Other
)
- Must allow adding funs to the namespaces
- May use the "Type" keyword (because every
inductive
declaration is called "inductive type") - Must not pollute the native namespaces
- Examples
def singleton (c : Char) : String := ⟨[c]⟩
must be inFierceNerdsUtil.String
namespace, notString
namespace
- Examples
- Must determine the namespace of the function according to the type family of the output (not the type of any of the inputs)
- Examples
def singleton (c : Char) : String := ⟨[c]⟩
must belong toFierceNerdsUtil.String
namespace, notFierceNerdsUtil.Char
namespace
- Examples
- Must determine the namespace of the
Coe
-like instance by the - Must place the typeclasses into their own namespaces (because they are actually types)
- Time to find the declaration via search
- VSCode shows the filename first, followed by directory
- Time to find the file via search
- VSCode filters by the filename first (so if the filename doesn't contain the type name, VSCode will show much lower in the list; even below the definitions)
- Time to find the right tab in the list
- VSCode has
workbench.editor.labelFormat
option with the following possible values:default
short
medium
long
- VSCode has
- Count of import commands
- How closely the file name matches the namespace
- Whether file name contains non-ASCII characters
- May need to be escaped in the shell
- Makes it more difficult to write code that manipulates them
- How granular the files should be?
- Outline
- If every declaration is in each own file, then the list of imports becomes too large
- The build time increases
- The navigation time increases
- The user can control the typeclass resolution (including coercions) by setting priorities
- If every declaration is in each own file, then the list of imports becomes too large
- Options
- Extreme: one declaration per
- Outline
- How to deal with "child types"?
- Examples
- ListUniqueBy
- Options
- Place them at the same level
- Examples
- Brand-first
- Examples
- BrandFirstV1
- Type/ListUniqueBy.lean
- Coe/ListUniqueBy_List.lean
- BrandFirstV1
- Examples
- Type-first
- Examples
- TypeFirstV1
- ListUniqueBy.lean
- Contains import commands for each file in subdirectory
- ListUniqueBy/Type.lean
- ListUniqueBy/Instance/Coe.lean
- ListUniqueBy/Instance.lean
- ListUniqueBy/Fun/Basic.lean
- ListUniqueBy.lean
- TypeFirstV1
- Examples
- Type-forward
- Examples
- TypeForwardV1
- ListUniqueBy.lean
- Contains type declaration
- Does not contain import commands for each file in subdirectory
- ListUniqueBy/Coe.lean
- ListUniqueBy/Fun.lean
- ListUniqueBy.lean
- TypeForwardV1
- Examples
- Brand-type
- Options
- "{brand}_{type}.lean"
- "{brand}'{type}.lean"
- "{brand}∘{type}.lean"
- "{brand}·{type}.lean"
- "{brand}⟩{type}.lean"
- "{brand}†{type}.lean"
- "{brand}▸{type}.lean"
- "{brand}✦{type}.lean"
- "{brand}★{type}.lean"
- "{brand}{type}.lean"
- "{type}{brand}.lean"
- Examples
- BrandTypeV1
- ListUniqueBy.lean
- Contains import commands for each file in subdirectory
- ListUniqueByType.lean
- ListUniqueByCoe.lean
- ListUniqueByFun.lean
- ListUniqueBy.lean
- BrandTypeV2
- ListUniqueBy.lean
- Contains import commands for each file in subdirectory
- ListUniqueByDef.lean
- ListUniqueByCoe.lean
- ListUniqueByFun.lean
- ListUniqueBy.lean
- BrandTypeV3
- ListUniqueBy.lean
- Contains import commands for each file in subdirectory
- TypeListUniqueBy.lean
- CoeListUniqueBy.lean
- FunListUniqueBy.lean
- ListUniqueBy.lean
- BrandTypeV1
- Notes
- Compound brands can be created with
∘
(example:Char∘String
) - Imports need to be quoted:
import FierceNerdsUtil.«Char∘String·Coe»
- Compound brands can be created with
- Options
- Namespace-first
- Examples
- FierceNerdsUtil/System/FilePath_Fun.lean
- FierceNerdsUtil/FierceNerds/Thought_Type.lean
- Examples
- Use BrandTypeV2
- canEditFilesInMultiplePackagesFromSingleWorkspace
- Can update the parent repo while working on the child repo
- canSharePackagesWithOtherDevelopers
- canUseCodeActionsInParentPackages
- Develop in separate repos
- Write the initial code in a single repo
- Use the same namespace (e.g.
FierceNerdsUtil
) - Maybe: use a special lib to indicate definitions that should be extracted (e.g.
Extract
,Addon
) - Move the files to intended repos
- Options
- Manually
- Automatically via script
- Merge existing files
- Options
- Conditional definition in lakefile
let source : Source := if getEnvVar s!"{pkgName}_USE_LOCAL_DEPS" then .path _ else .git _ _ _
- Submodules
- Hack in pre-commit
- Replace the
.path
dep with the.git
dep before commit - Restore it after commit
- Replace the
- Ask lurk-lab devs
- Ask on Zulip
- Develop in separate repos
- It's the only one that supports
canUseCodeActionsInParentPackages
- It's the only one that supports