Learn
Find docs
part / startOpenStartBegin with setup, one file, one binding model, one expression model, then explicit mutation.part / coreOpenCore SyntaxLearn everyday syntax in very small pieces so nothing stacks too early.part / dataOpenDataKeep data-shape learning readable by separating records, sequences, and patterns.part / organizationOpenCode OrganizationGrow from one file to packages without changing the mental model of code flow.part / typesOpenTypesIntroduce types gradually: explicit first, inferred second, generic third.part / abstractionsOpenAbstractionsSeparate behavior shape, concrete implementation, and semantic law into distinct chapters.part / effects-runtimeOpenEffects and RuntimeMake effect flow explicit, then place runtime and stdlib on top of that model.part / developersOpenMusi for DevelopersTranslate familiar habits into Musi without carrying over syntax that does not fit.part / advancedOpenAdvanced and ToolingKeep sharp or advanced topics late, after ordinary code already feels natural.section / Musi for Developers / Musi for C DevelopersOpenMusi for C DevelopersC99-specific contrasts for functions, structs, arrays, pointers, errors, packages, tests, and native boundaries.section / Musi for Developers / Musi for C++ DevelopersOpenMusi for C++ DevelopersC++17-specific contrasts for functions, records, variants, templates, packages, tests, and native boundaries.section / Musi for Developers / Musi for Rust DevelopersOpenMusi for Rust DevelopersRust-specific contrasts for mutation, data, traits, effects, and native boundaries.section / Musi for Developers / Musi for C# DevelopersOpenMusi for C# DevelopersC#-specific contrasts for methods, records, collections, nullability, exceptions, interfaces, packages, tests, and native boundaries.section / Musi for Developers / Musi for Go DevelopersOpenMusi for Go DevelopersGo-specific contrasts for functions, structs, slices, nil, errors, concurrency, interfaces, packages, tests, and native boundaries.section / Musi for Developers / Musi for JavaScript and TypeScript DevelopersOpenMusi for JavaScript and TypeScript DevelopersSide-by-side contrasts for objects, functions, unions, generics, promises, modules, and tests.section / Musi for Developers / Musi for Lua DevelopersOpenMusi for Lua DevelopersLua-specific contrasts for locals, functions, tables, nil, errors, coroutines, metatables, modules, tests, and native boundaries.section / Musi for Developers / Musi for Java DevelopersOpenMusi for Java DevelopersJava-specific contrasts for methods, records, collections, nullability, exceptions, sealed types, interfaces, packages, tests, and native boundaries.section / Musi for Developers / Musi for Python DevelopersOpenMusi for Python DevelopersPython-specific contrasts for functions, blocks, objects, collections, errors, protocols, modules, tests, and native boundaries.chapter / StartOpenGetting StartedInstall tools, install Musi, and learn the two command lanes.chapter / StartOpenFirst ProgramWrite one file, bind one value, and run it end to end.chapter / StartOpenReading Musi CodeRead declarations, imports, final expressions, type notes, and effect requests in the order a beginner sees them.chapter / StartOpenValues and LetUse `let` to name values, define callables, and understand when recursion needs `let rec`.chapter / StartOpenBlocks and ExpressionsTreat a block as one expression with setup at the top and the result at the bottom.chapter / StartOpenMutationUse mut only when changing a value helps more than rebuilding it.chapter / Core SyntaxOpenLiteralsStart with numbers, strings, booleans, runes, and template text.chapter / Core SyntaxOpenTuples and UnitUse tuple expressions for small positional groups and unit when no payload matters.chapter / Core SyntaxOpenOperatorsRead arithmetic, comparison, and logic in ordinary expressions.chapter / Core SyntaxOpenRangesRead open, closed, and spread-like range forms without guessing.chapter / Core SyntaxOpenFunctionsFunctions are ordinary `let` bindings with parameters, result types, and expression bodies.chapter / Core SyntaxOpenLambdasUse lambda expressions when a short function value reads better in place.chapter / Core SyntaxOpenCallsCall functions directly and follow argument flow left to right.chapter / Core SyntaxOpenDot CallsUse dot-callable functions through dot notation without needing an impl block.chapter / DataOpenRecordsBuild named-field values and access fields directly.chapter / DataOpenIndexing and FieldsUse `.field` for named data and `.[index]` for positional access.chapter / DataOpenData DefinitionsUse `data` for named shapes, variant choices, payload fields, and record defaults.chapter / DataOpenArrays and SlicesStore ordered values and learn where slices fit.chapter / DataOpenPatternsUse match and destructuring to branch on data shape.chapter / DataOpenOption and ResultUse Option for expected absence and Result for work that can explain why it failed.chapter / Code OrganizationOpenFilesKnow what a single file means before building a package.chapter / Code OrganizationOpenPackagesMove from one file to package-managed code without changing mental models.chapter / Code OrganizationOpenImports and ExportsBring code in explicitly and expose only what other files need.chapter / TypesOpenType AnnotationsLearn the visible boundary markers for values, constraints, callable types, and data variants.chapter / TypesOpenCallable TypesUse `T -> U` for pure callables and `T ~> U` for effectful callables.chapter / TypesOpenType InferenceSee what Musi can infer so you know when to write less.chapter / TypesOpenGenericsWrite reusable functions over many types without losing clarity.chapter / TypesOpenType Tests and CastsUse `:?` to test a value against a type and `:?>` for an explicit cast.chapter / TypesOpenForall TypesUse `forall` when a type expression must bind a type variable explicitly.chapter / TypesOpenDependent TypesUse value-indexed types, indexed data results, `partial`, and `~=` without turning Musi into a proof assistant.chapter / AbstractionsOpenClassesDescribe shared behavior with class declarations.chapter / AbstractionsOpenInstancesAttach concrete behavior to concrete types.chapter / AbstractionsOpenLawsUse laws to document the meaning of an abstraction, not just its shape.chapter / Effects and RuntimeOpenEffectsUnderstand effects as requests for work, not immediate hidden side effects.chapter / Effects and RuntimeOpenUsing`using` tells readers and the compiler which effects a callable may request.chapter / Effects and RuntimeOpenErrors and RecoveryUse Option for absence, Result for explained failure, and effects for work that needs an outside answer.chapter / Effects and RuntimeOpenHandlersResolve requested effects at the boundary where policy belongs.chapter / Effects and RuntimeOpenFoundationUnderstand what belongs to musi:core before reaching for stdlib modules.chapter / Effects and RuntimeOpenRuntimeUse musi:runtime for runtime-backed capabilities and host services.chapter / Effects and RuntimeOpenStdlibReach for @std modules first in ordinary application code.chapter / Advanced and ToolingOpenAttributesAttributes describe metadata, boundaries, and build-time intent without changing Musi into a macro language.chapter / Advanced and ToolingOpenForeignDeclare foreign bindings at the runtime boundary, not inside ordinary domain code.chapter / Advanced and ToolingOpenUnsafe and FFIKeep raw pointer and native-call work behind a visible unsafe boundary.chapter / Advanced and ToolingOpenOperator FormsUse fixity declarations and parenthesized operator names for advanced operator-heavy code.chapter / Advanced and ToolingOpenQuote and SyntaxTreat code as data only after ordinary code reading feels natural.chapter / Advanced and ToolingOpenComptimeUse value-position comptime for constants, specialization, and generated syntax.chapter / Advanced and ToolingOpenTemplates and SplicesUse template literals for interpolated text and splice forms when building syntax.chapter / Advanced and ToolingOpenTestingWrite small package tests that read like ordinary code.chapter / Advanced and ToolingOpenRunning and ToolingFinish with the everyday command flow for checking, running, and building code.chapter / Musi for Developers / Musi for C DevelopersOpenOverviewUse this guide when C99 habits make Musi feel surprising.chapter / Musi for Developers / Musi for C DevelopersOpenValues, Functions, and ExpressionsTranslate the C99 habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for C DevelopersOpenBlocks and Control FlowTranslate the C99 habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for C DevelopersOpenVariables and MutationTranslate the C99 habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for C DevelopersOpenStructs, Classes, and RecordsTranslate the C99 habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for C DevelopersOpenArrays, Pointers, and SlicesTranslate the C99 habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for C DevelopersOpenNull, Option, and ResultTranslate the C99 habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for C DevelopersOpenErrors, Results, and EffectsTranslate the C99 habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for C DevelopersOpenEnums, Variants, and PatternsTranslate the C99 habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for C DevelopersOpenMacros, Generics, Classes, and LawsTranslate the C99 habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for C DevelopersOpenMethods and Receiver CallsTranslate the C99 habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for C DevelopersOpenHeaders, Modules, and PackagesTranslate the C99 habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for C DevelopersOpenTesting and ToolingTranslate the C99 habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for C DevelopersOpenUnsafe, FFI, and Native BoundariesTranslate the C99 habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for C++ DevelopersOpenOverviewUse this guide when C++17 habits make Musi feel surprising.chapter / Musi for Developers / Musi for C++ DevelopersOpenValues, Functions, and ExpressionsTranslate the C++17 habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for C++ DevelopersOpenBlocks and Control FlowTranslate the C++17 habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for C++ DevelopersOpenVariables and MutationTranslate the C++17 habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for C++ DevelopersOpenStructs, Classes, and RecordsTranslate the C++17 habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for C++ DevelopersOpenArrays, Pointers, and SlicesTranslate the C++17 habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for C++ DevelopersOpenNull, Option, and ResultTranslate the C++17 habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for C++ DevelopersOpenErrors, Results, and EffectsTranslate the C++17 habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for C++ DevelopersOpenEnums, Variants, and PatternsTranslate the C++17 habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for C++ DevelopersOpenTemplates, Concepts, Classes, and LawsTranslate the C++17 habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for C++ DevelopersOpenMethods and Receiver CallsTranslate the C++17 habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for C++ DevelopersOpenHeaders, Modules, and PackagesTranslate the C++17 habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for C++ DevelopersOpenTesting and ToolingTranslate the C++17 habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for C++ DevelopersOpenUnsafe, FFI, and Native BoundariesTranslate the C++17 habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for C# DevelopersOpenOverviewUse this guide when C# habits make Musi feel surprising.chapter / Musi for Developers / Musi for C# DevelopersOpenValues, Methods, and ExpressionsTranslate the C# habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for C# DevelopersOpenBlocks and Control FlowTranslate the C# habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for C# DevelopersOpenVariables and MutationTranslate the C# habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for C# DevelopersOpenRecords, Classes, and ObjectsTranslate the C# habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for C# DevelopersOpenCollections, LINQ, and PipelinesTranslate the C# habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for C# DevelopersOpenNull, Option, and ResultTranslate the C# habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for C# DevelopersOpenExceptions, Results, and EffectsTranslate the C# habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for C# DevelopersOpenUnions and Pattern MatchingTranslate the C# habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for C# DevelopersOpenGenerics, Interfaces, and LawsTranslate the C# habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for C# DevelopersOpenExtension Methods and CallsTranslate the C# habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for C# DevelopersOpenNamespaces, Modules, and PackagesTranslate the C# habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for C# DevelopersOpenTesting and ToolingTranslate the C# habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for C# DevelopersOpenUnsafe, Interop, and FFITranslate the C# habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for Go DevelopersOpenOverviewUse this guide when Go habits make Musi feel surprising.chapter / Musi for Developers / Musi for Go DevelopersOpenValues, Functions, and Final ExpressionsTranslate the Go habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for Go DevelopersOpenBlocks, Branching, and LoopsTranslate the Go habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for Go DevelopersOpenVariables, Short Declarations, and MutationTranslate the Go habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for Go DevelopersOpenStructs, Records, and Field UpdatesTranslate the Go habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for Go DevelopersOpenSlices, Arrays, Maps, and PipelinesTranslate the Go habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for Go DevelopersOpenNil, Option, and ResultTranslate the Go habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for Go DevelopersOpenErrors, Results, and EffectsTranslate the Go habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for Go DevelopersOpenGoroutines, Channels, Context, and EffectsTranslate the Go habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for Go DevelopersOpenInterfaces, Classes, Instances, and LawsTranslate the Go habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for Go DevelopersOpenGenerics and Type ConstructorsTranslate the Go habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for Go DevelopersOpenMethods and Receiver CallsTranslate the Go habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for Go DevelopersOpenPackages, Imports, and ExportsTranslate the Go habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for Go DevelopersOpenTesting and ToolingTranslate the Go habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for Go DevelopersOpenUnsafe, Cgo, and FFITranslate the Go habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for Java DevelopersOpenOverviewUse this guide when Java habits make Musi feel surprising.chapter / Musi for Developers / Musi for Java DevelopersOpenValues, Methods, and ExpressionsTranslate the Java habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for Java DevelopersOpenBlocks and Control FlowTranslate the Java habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for Java DevelopersOpenVariables and MutationTranslate the Java habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for Java DevelopersOpenRecords, Classes, and ObjectsTranslate the Java habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for Java DevelopersOpenCollections, Streams, and PipelinesTranslate the Java habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for Java DevelopersOpenNull, Option, and ResultTranslate the Java habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for Java DevelopersOpenExceptions and EffectsTranslate the Java habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for Java DevelopersOpenSealed Types and PatternsTranslate the Java habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for Java DevelopersOpenGenerics, Interfaces, and LawsTranslate the Java habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for Java DevelopersOpenMethods and Receiver CallsTranslate the Java habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for Java DevelopersOpenPackages and ModulesTranslate the Java habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for Java DevelopersOpenTesting and ToolingTranslate the Java habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for Java DevelopersOpenNative, Unsafe, and FFITranslate the Java habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for JavaScript and TypeScript DevelopersOpenOverviewUse this guide when JavaScript and TypeScript habits make Musi feel surprising.chapter / Musi for Developers / Musi for JavaScript and TypeScript DevelopersOpenValues, Functions, and Final ExpressionsTranslate the JavaScript and TypeScript habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for JavaScript and TypeScript DevelopersOpen`let`, `const`, and Mutable StateTranslate the JavaScript and TypeScript habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for JavaScript and TypeScript DevelopersOpenObjects, Records, and Field UpdatesTranslate the JavaScript and TypeScript habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for JavaScript and TypeScript DevelopersOpenArrays and Data PipelinesTranslate the JavaScript and TypeScript habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for JavaScript and TypeScript DevelopersOpenNull, Undefined, Option, and ResultTranslate the JavaScript and TypeScript habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for JavaScript and TypeScript DevelopersOpenUnions, Variants, and Pattern MatchingTranslate the JavaScript and TypeScript habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for JavaScript and TypeScript DevelopersOpenGenerics and Type ParametersTranslate the JavaScript and TypeScript habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for JavaScript and TypeScript DevelopersOpenPromises, Async, and I/O BoundariesTranslate the JavaScript and TypeScript habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for JavaScript and TypeScript DevelopersOpenModules, Packages, and ImportsTranslate the JavaScript and TypeScript habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for JavaScript and TypeScript DevelopersOpenClasses, Objects, and Shared BehaviorTranslate the JavaScript and TypeScript habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for JavaScript and TypeScript DevelopersOpenTesting and ToolingTranslate the JavaScript and TypeScript habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for Lua DevelopersOpenOverviewUse this guide when Lua habits make Musi feel surprising.chapter / Musi for Developers / Musi for Lua DevelopersOpenValues, Locals, and ExpressionsTranslate the Lua habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for Lua DevelopersOpenFunctions, Closures, and Named CallsTranslate the Lua habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for Lua DevelopersOpenBlocks, Branching, and RepetitionTranslate the Lua habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for Lua DevelopersOpenTables, Records, and Field UpdatesTranslate the Lua habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for Lua DevelopersOpenArrays, Sequences, Maps, and PipelinesTranslate the Lua habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for Lua DevelopersOpenNil, Option, and ResultTranslate the Lua habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for Lua DevelopersOpenErrors, Pcall, and EffectsTranslate the Lua habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for Lua DevelopersOpenCoroutines and Effect BoundariesTranslate the Lua habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for Lua DevelopersOpenMetatables, Classes, Instances, and LawsTranslate the Lua habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for Lua DevelopersOpenPattern Matching and Data VariantsTranslate the Lua habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for Lua DevelopersOpenModules, Imports, and ExportsTranslate the Lua habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for Lua DevelopersOpenTesting and ToolingTranslate the Lua habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for Lua DevelopersOpenEmbedding, C API, and FFITranslate the Lua habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for Python DevelopersOpenOverviewUse this guide when Python habits make Musi feel surprising.chapter / Musi for Developers / Musi for Python DevelopersOpenValues, Functions, and Final ExpressionsTranslate the Python habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for Python DevelopersOpenBlocks, Control Flow, and RepetitionTranslate the Python habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for Python DevelopersOpenNames, Mutation, and Fresh ValuesTranslate the Python habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for Python DevelopersOpenRecords, Objects, and DictionariesTranslate the Python habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for Python DevelopersOpenCollections and PipelinesTranslate the Python habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for Python DevelopersOpenNone, Option, and ResultTranslate the Python habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for Python DevelopersOpenExceptions, Results, and EffectsTranslate the Python habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for Python DevelopersOpenData Variants and Pattern MatchingTranslate the Python habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for Python DevelopersOpenTypes, Generics, and ProtocolsTranslate the Python habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for Python DevelopersOpenModules and PackagesTranslate the Python habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for Python DevelopersOpenTesting and ToolingTranslate the Python habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for Python DevelopersOpenNative Boundaries, Unsafe, and FFITranslate the Python habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for Rust DevelopersOpenOverviewUse this guide when Rust habits make Musi feel surprising.chapter / Musi for Developers / Musi for Rust DevelopersOpenValues, Functions, and Final ExpressionsTranslate the Rust habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for Rust DevelopersOpenMutationTranslate the Rust habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for Rust DevelopersOpenRecords, Structs, and Field UpdatesTranslate the Rust habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for Rust DevelopersOpenEnums, Data, and Pattern MatchingTranslate the Rust habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for Rust DevelopersOpenTraits, Classes, Instances, and LawsTranslate the Rust habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for Rust DevelopersOpenGenerics and Type ConstructorsTranslate the Rust habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for Rust DevelopersOpenResults, I/O, and EffectsTranslate the Rust habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for Rust DevelopersOpenModules, Packages, and VisibilityTranslate the Rust habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for Rust DevelopersOpenUnsafe and FFITranslate the Rust habit, then use the Musi Book for the full rule.chapter / Musi for Developers / Musi for Rust DevelopersOpenTesting and ToolingTranslate the Rust habit, then use the Musi Book for the full rule.
No matching docs yet. Try a command, type, effect, or language name.
Learn · Musi Book
This is the main book. It moves from first file to syntax, data, types, effects, and tooling. Language guides are separate because they answer a different question.
Start
Open section
Begin with setup, one file, one binding model, one expression model, then explicit mutation.
Chapter»Getting StartedInstall tools, install Musi, and learn the two command lanes.Chapter»First ProgramWrite one file, bind one value, and run it end to end.Chapter»Reading Musi CodeRead declarations, imports, final expressions, type notes, and effect requests in the order a beginner sees them.Chapter»Values and LetUse
let to name values, define callables, and understand when recursion needs let rec.Chapter»Blocks and ExpressionsTreat a block as one expression with setup at the top and the result at the bottom.Chapter»MutationUse mut only when changing a value helps more than rebuilding it.Core Syntax
Open section
Learn everyday syntax in very small pieces so nothing stacks too early.
Chapter»LiteralsStart with numbers, strings, booleans, runes, and template text.Chapter»OperatorsRead arithmetic, comparison, and logic in ordinary expressions.Chapter»Tuples and UnitUse tuple expressions for small positional groups and unit when no payload matters.Chapter»RangesRead open, closed, and spread-like range forms without guessing.Chapter»FunctionsFunctions are ordinary
let bindings with parameters, result types, and expression bodies.Chapter»CallsCall functions directly and follow argument flow left to right.Chapter»Dot CallsUse dot-callable functions through dot notation without needing an impl block.Chapter»LambdasUse lambda expressions when a short function value reads better in place.Data
Open section
Keep data-shape learning readable by separating records, sequences, and patterns.
Chapter»RecordsBuild named-field values and access fields directly.Chapter»Arrays and SlicesStore ordered values and learn where slices fit.Chapter»Indexing and FieldsUse
.field for named data and .[index] for positional access.Chapter»PatternsUse match and destructuring to branch on data shape.Chapter»Data DefinitionsUse data for named shapes, variant choices, payload fields, and record defaults.Chapter»Option and ResultUse Option for expected absence and Result for work that can explain why it failed.Code Organization
Open section
Grow from one file to packages without changing the mental model of code flow.
Types
Open section
Introduce types gradually: explicit first, inferred second, generic third.
Chapter»Type AnnotationsLearn the visible boundary markers for values, constraints, callable types, and data variants.Chapter»Callable TypesUse
T -> U for pure callables and T ~> U for effectful callables.Chapter»Type InferenceSee what Musi can infer so you know when to write less.Chapter»GenericsWrite reusable functions over many types without losing clarity.Chapter»Type Tests and CastsUse :? to test a value against a type and :?> for an explicit cast.Chapter»Forall TypesUse forall when a type expression must bind a type variable explicitly.Chapter»Dependent TypesUse value-indexed types, indexed data results, partial, and ~= without turning Musi into a proof assistant.Abstractions
Open section
Separate behavior shape, concrete implementation, and semantic law into distinct chapters.
Effects and Runtime
Open section
Make effect flow explicit, then place runtime and stdlib on top of that model.
Chapter»EffectsUnderstand effects as requests for work, not immediate hidden side effects.Chapter»Errors and RecoveryUse Option for absence, Result for explained failure, and effects for work that needs an outside answer.Chapter»Using
using tells readers and the compiler which effects a callable may request.Chapter»HandlersResolve requested effects at the boundary where policy belongs.Chapter»FoundationUnderstand what belongs to musi:core before reaching for stdlib modules.Chapter»RuntimeUse musi:runtime for runtime-backed capabilities and host services.Chapter»StdlibReach for @std modules first in ordinary application code.Advanced and Tooling
Open section
Keep sharp or advanced topics late, after ordinary code already feels natural.
Chapter»AttributesAttributes describe metadata, boundaries, and build-time intent without changing Musi into a macro language.Chapter»ForeignDeclare foreign bindings at the runtime boundary, not inside ordinary domain code.Chapter»Operator FormsUse fixity declarations and parenthesized operator names for advanced operator-heavy code.Chapter»Quote and SyntaxTreat code as data only after ordinary code reading feels natural.Chapter»Unsafe and FFIKeep raw pointer and native-call work behind a visible unsafe boundary.Chapter»ComptimeUse value-position comptime for constants, specialization, and generated syntax.Chapter»TestingWrite small package tests that read like ordinary code.Chapter»Running and ToolingFinish with the everyday command flow for checking, running, and building code.Chapter»Templates and SplicesUse template literals for interpolated text and splice forms when building syntax.
Guides · Musi for Developers
Use these pages only when you want to map C, Rust, Python, JavaScript, or another known language into Musi terms.
Musi for Developers
Open guides
Translate familiar habits into Musi without carrying over syntax that does not fit.
Section · 14»Musi for C DevelopersC99-specific contrasts for functions, structs, arrays, pointers, errors, packages, tests, and native boundaries.Section · 14»Musi for C++ DevelopersC++17-specific contrasts for functions, records, variants, templates, packages, tests, and native boundaries.Section · 14»Musi for C# DevelopersC#-specific contrasts for methods, records, collections, nullability, exceptions, interfaces, packages, tests, and native boundaries.Section · 15»Musi for Go DevelopersGo-specific contrasts for functions, structs, slices, nil, errors, concurrency, interfaces, packages, tests, and native boundaries.Section · 14»Musi for Java DevelopersJava-specific contrasts for methods, records, collections, nullability, exceptions, sealed types, interfaces, packages, tests, and native boundaries.Section · 12»Musi for JavaScript and TypeScript DevelopersSide-by-side contrasts for objects, functions, unions, generics, promises, modules, and tests.Section · 14»Musi for Lua DevelopersLua-specific contrasts for locals, functions, tables, nil, errors, coroutines, metatables, modules, tests, and native boundaries.Section · 13»Musi for Python DevelopersPython-specific contrasts for functions, blocks, objects, collections, errors, protocols, modules, tests, and native boundaries.Section · 11»Musi for Rust DevelopersRust-specific contrasts for mutation, data, traits, effects, and native boundaries.