├── .editorconfig ├── .gitattributes ├── .github ├── CODEOWNERS ├── ISSUE_TEMPLATE │ ├── bug_report.md │ ├── error-message-suggestion.md │ └── feature_request.md ├── pull_request_template.md └── workflows │ ├── bundle-ucm.yaml │ ├── check-contributor.yaml │ ├── ci-build-jit-binary.yaml │ ├── ci-test-jit.yaml │ ├── ci.md │ ├── ci.yaml │ ├── format.yaml │ ├── haddocks.yaml │ ├── nix-dev-cache.yaml │ ├── ormolu.yaml │ ├── pre-release.yaml │ ├── release.yaml │ └── update-transcripts.yaml ├── .gitignore ├── .mailmap ├── .mergify.yml ├── .ormolu ├── .vscode └── settings.json ├── CONTRIBUTORS.markdown ├── CREDITS.md ├── Dockerfile ├── LICENSE ├── README.md ├── codebase2 ├── LICENSE ├── codebase-sqlite-hashing-v2 │ ├── package.yaml │ ├── src │ │ ├── U │ │ │ └── Codebase │ │ │ │ ├── Branch │ │ │ │ └── Hashing.hs │ │ │ │ ├── Causal │ │ │ │ └── Hashing.hs │ │ │ │ ├── Decl │ │ │ │ └── Hashing.hs │ │ │ │ ├── Sqlite │ │ │ │ └── V2 │ │ │ │ │ └── HashHandle.hs │ │ │ │ └── Term │ │ │ │ └── Hashing.hs │ │ └── Unison │ │ │ └── Hashing │ │ │ └── V2 │ │ │ └── Convert2.hs │ └── unison-codebase-sqlite-hashing-v2.cabal ├── codebase-sqlite │ ├── U │ │ └── Codebase │ │ │ ├── Branch.hs │ │ │ ├── Causal │ │ │ └── Squash.hs │ │ │ └── Sqlite │ │ │ ├── Branch │ │ │ ├── Diff.hs │ │ │ ├── Format.hs │ │ │ └── Full.hs │ │ │ ├── Causal.hs │ │ │ ├── DbId.hs │ │ │ ├── Decl │ │ │ └── Format.hs │ │ │ ├── Decode.hs │ │ │ ├── Entity.hs │ │ │ ├── HashHandle.hs │ │ │ ├── LocalIds.hs │ │ │ ├── LocalizeObject.hs │ │ │ ├── NameLookups.hs │ │ │ ├── NamedRef.hs │ │ │ ├── ObjectType.hs │ │ │ ├── Operations.hs │ │ │ ├── Orphans.hs │ │ │ ├── Patch │ │ │ ├── Diff.hs │ │ │ ├── Format.hs │ │ │ ├── Full.hs │ │ │ ├── TermEdit.hs │ │ │ └── TypeEdit.hs │ │ │ ├── Project.hs │ │ │ ├── ProjectBranch.hs │ │ │ ├── ProjectReflog.hs │ │ │ ├── Queries.hs │ │ │ ├── Reference.hs │ │ │ ├── Referent.hs │ │ │ ├── RemoteProject.hs │ │ │ ├── RemoteProjectBranch.hs │ │ │ ├── Serialization.hs │ │ │ ├── Symbol.hs │ │ │ ├── TempEntity.hs │ │ │ ├── TempEntityType.hs │ │ │ └── Term │ │ │ └── Format.hs │ ├── package.yaml │ ├── sql │ │ ├── 001-temp-entity-tables.sql │ │ ├── 002-reflog-table.sql │ │ ├── 003-namespace-statistics.sql │ │ ├── 004-fix-scoped-name-lookup-tables.sql │ │ ├── 005-project-tables.sql │ │ ├── 006-most-recent-branch-table.sql │ │ ├── 007-add-name-lookup-mounts.sql │ │ ├── 008-add-most-recent-namespace-table.sql │ │ ├── 009-add-squash-cache-table.sql │ │ ├── 010-ensure-squash-cache-table.sql │ │ ├── 011-cd-to-project-root.sql │ │ ├── 012-add-current-project-path-table.sql │ │ ├── 013-add-project-branch-reflog-table.sql │ │ ├── 014-add-project-branch-causal-hash-id.sql │ │ ├── 015-add-project-branch-last-accessed.sql │ │ ├── 016-add-merge-branch-tables.sql │ │ └── create.sql │ └── unison-codebase-sqlite.cabal ├── codebase-sync │ ├── U │ │ └── Codebase │ │ │ └── Sync.hs │ ├── package.yaml │ └── unison-codebase-sync.cabal ├── codebase │ ├── U │ │ └── Codebase │ │ │ ├── Branch │ │ │ └── Type.hs │ │ │ ├── BranchV3.hs │ │ │ ├── Causal.hs │ │ │ ├── Decl.hs │ │ │ ├── Kind.hs │ │ │ ├── Referent.hs │ │ │ ├── Reflog.hs │ │ │ ├── Term.hs │ │ │ ├── TermEdit.hs │ │ │ ├── Type.hs │ │ │ ├── TypeEdit.hs │ │ │ └── WatchKind.hs │ ├── package.yaml │ └── unison-codebase.cabal ├── core │ ├── U │ │ ├── Codebase │ │ │ ├── HashTags.hs │ │ │ └── Reference.hs │ │ └── Core │ │ │ ├── ABT.hs │ │ │ └── ABT │ │ │ └── Var.hs │ ├── Unison │ │ ├── Core │ │ │ └── Project.hs │ │ ├── NameSegment.hs │ │ ├── NameSegment │ │ │ └── Internal.hs │ │ ├── ShortHash.hs │ │ └── Util │ │ │ └── Alphabetical.hs │ ├── package.yaml │ └── unison-core.cabal ├── util-serialization │ ├── U │ │ └── Util │ │ │ └── Serialization.hs │ ├── package.yaml │ └── unison-util-serialization.cabal └── util-term │ ├── U │ └── Util │ │ ├── Term.hs │ │ └── Type.hs │ ├── package.yaml │ └── unison-util-term.cabal ├── config ├── contrib └── cabal.project ├── deps ├── fsutils └── relation ├── dest.usync ├── dev-ui-install.sh ├── development.markdown ├── docs ├── ability-typechecking.markdown ├── adding-builtins.markdown ├── branchless-scratch.md ├── branchless.md ├── codebase-editor-design.markdown ├── commandline-editor-dev.md ├── comments-and-docs.markdown ├── configuration.md ├── data-types.markdown ├── distributed-api-discussion-v1.md ├── distributed-garbage-collection.markdown ├── distributed-programming-rfc.markdown ├── github-actions-help.md ├── language-server.markdown ├── metadata.markdown ├── nix.md ├── publishing-library1.md ├── publishing-library2.md ├── publishing.md ├── release-steps.md ├── repoformats │ ├── v1-DRAFT.markdown │ └── v2.markdown ├── runtime-calling-conventions.markdown ├── sharing-code.markdown ├── testing.markdown └── type-declarations.markdown ├── editor-support ├── atom │ └── language-unison │ │ ├── grammars │ │ └── unison.cson │ │ ├── package.json │ │ └── settings │ │ └── settings.cson └── vim │ ├── doc │ └── unison.txt │ ├── ftdetect │ └── unison.vim │ ├── ftplugin │ └── unison.vim │ └── syntax │ └── unison.vim ├── flake.lock ├── flake.nix ├── hie.yaml ├── lib ├── orphans │ ├── README.md │ ├── network-uri-orphans-sqlite │ │ ├── network-uri-orphans-sqlite.cabal │ │ ├── package.yaml │ │ └── src │ │ │ └── Network │ │ │ └── URI │ │ │ └── Orphans │ │ │ └── Sqlite.hs │ ├── unison-core-orphans-sqlite │ │ ├── package.yaml │ │ ├── src │ │ │ └── Unison │ │ │ │ └── Core │ │ │ │ └── Orphans │ │ │ │ └── Sqlite.hs │ │ └── unison-core-orphans-sqlite.cabal │ ├── unison-hash-orphans-aeson │ │ ├── package.yaml │ │ ├── src │ │ │ └── Unison │ │ │ │ └── Hash32 │ │ │ │ └── Orphans │ │ │ │ └── Aeson.hs │ │ └── unison-hash-orphans-aeson.cabal │ ├── unison-hash-orphans-sqlite │ │ ├── package.yaml │ │ ├── src │ │ │ └── Unison │ │ │ │ └── Hash32 │ │ │ │ └── Orphans │ │ │ │ └── Sqlite.hs │ │ └── unison-hash-orphans-sqlite.cabal │ └── uuid-orphans-sqlite │ │ ├── package.yaml │ │ ├── src │ │ └── Data │ │ │ └── UUID │ │ │ └── Orphans │ │ │ └── Sqlite.hs │ │ └── uuid-orphans-sqlite.cabal ├── unison-hash │ ├── package.yaml │ ├── src │ │ └── Unison │ │ │ ├── Hash.hs │ │ │ └── Hash32.hs │ └── unison-hash.cabal ├── unison-hashing │ ├── package.yaml │ ├── src │ │ └── Unison │ │ │ └── Hashing │ │ │ └── ContentAddressable.hs │ └── unison-hashing.cabal ├── unison-prelude │ ├── package.yaml │ ├── src │ │ ├── U │ │ │ └── Util │ │ │ │ └── Text.hs │ │ └── Unison │ │ │ ├── Debug.hs │ │ │ ├── Prelude.hs │ │ │ └── Util │ │ │ ├── Alternative.hs │ │ │ ├── Lens.hs │ │ │ ├── List.hs │ │ │ ├── Map.hs │ │ │ ├── Monoid.hs │ │ │ ├── Set.hs │ │ │ ├── Timing.hs │ │ │ └── Tuple.hs │ └── unison-prelude.cabal ├── unison-pretty-printer │ ├── LICENSE │ ├── package.yaml │ ├── prettyprintdemo │ │ └── Main.hs │ ├── src │ │ └── Unison │ │ │ ├── PrettyTerminal.hs │ │ │ └── Util │ │ │ ├── AnnotatedText.hs │ │ │ ├── ColorText.hs │ │ │ ├── Less.hs │ │ │ ├── Pretty.hs │ │ │ ├── Range.hs │ │ │ └── SyntaxText.hs │ ├── tests │ │ ├── Suite.hs │ │ └── Unison │ │ │ └── Test │ │ │ ├── ColorText.hs │ │ │ ├── Range.hs │ │ │ └── Util │ │ │ └── Pretty.hs │ └── unison-pretty-printer.cabal ├── unison-sqlite │ ├── README.md │ ├── package.yaml │ ├── src │ │ └── Unison │ │ │ ├── Sqlite.hs │ │ │ └── Sqlite │ │ │ ├── Connection.hs │ │ │ ├── Connection │ │ │ └── Internal.hs │ │ │ ├── DataVersion.hs │ │ │ ├── Exception.hs │ │ │ ├── Internal.hs │ │ │ ├── JournalMode.hs │ │ │ ├── Sql.hs │ │ │ ├── Transaction.hs │ │ │ └── Utils.hs │ ├── test │ │ └── Main.hs │ └── unison-sqlite.cabal ├── unison-util-base32hex │ ├── package.yaml │ ├── src │ │ └── U │ │ │ └── Util │ │ │ └── Base32Hex.hs │ └── unison-util-base32hex.cabal ├── unison-util-bytes │ ├── package.yaml │ ├── src │ │ └── Unison │ │ │ └── Util │ │ │ └── Bytes.hs │ ├── test │ │ └── Main.hs │ └── unison-util-bytes.cabal ├── unison-util-cache │ ├── package.yaml │ ├── src │ │ └── Unison │ │ │ └── Util │ │ │ └── Cache.hs │ ├── test │ │ └── Main.hs │ └── unison-util-cache.cabal ├── unison-util-file-embed │ ├── package.yaml │ ├── src │ │ └── Unison │ │ │ └── Util │ │ │ └── FileEmbed.hs │ └── unison-util-file-embed.cabal ├── unison-util-recursion │ ├── package.yaml │ ├── src │ │ └── Unison │ │ │ └── Util │ │ │ └── Recursion.hs │ └── unison-util-recursion.cabal ├── unison-util-relation │ ├── benchmarks │ │ └── relation │ │ │ └── Main.hs │ ├── package.yaml │ ├── src │ │ └── Unison │ │ │ └── Util │ │ │ ├── BiMultimap.hs │ │ │ ├── Relation.hs │ │ │ ├── Relation3.hs │ │ │ └── Relation4.hs │ ├── test │ │ └── Main.hs │ └── unison-util-relation.cabal └── unison-util-rope │ ├── package.yaml │ ├── src │ └── Unison │ │ └── Util │ │ └── Rope.hs │ └── unison-util-rope.cabal ├── nix ├── README.md ├── dependencies.nix ├── docker.nix ├── haskell-nix-flake.nix ├── unison-project.nix └── versions.nix ├── package.yaml ├── parser-typechecker ├── LICENSE ├── package.yaml ├── src │ ├── U │ │ └── Codebase │ │ │ ├── Branch │ │ │ └── Diff.hs │ │ │ └── Projects.hs │ └── Unison │ │ ├── Builtin.hs │ │ ├── Builtin │ │ ├── Decls.hs │ │ └── Terms.hs │ │ ├── Codebase.hs │ │ ├── Codebase │ │ ├── Branch.hs │ │ ├── Branch │ │ │ ├── BranchDiff.hs │ │ │ ├── Merge.hs │ │ │ ├── Names.hs │ │ │ ├── Raw.hs │ │ │ └── Type.hs │ │ ├── BranchDiff.hs │ │ ├── BranchUtil.hs │ │ ├── BuiltinAnnotation.hs │ │ ├── Causal.hs │ │ ├── Causal │ │ │ └── Type.hs │ │ ├── CodeLookup.hs │ │ ├── CodeLookup │ │ │ └── Util.hs │ │ ├── Editor │ │ │ ├── DisplayObject.hs │ │ │ └── RemoteRepo.hs │ │ ├── FileCodebase.hs │ │ ├── Init.hs │ │ ├── Init │ │ │ ├── CreateCodebaseError.hs │ │ │ ├── OpenCodebaseError.hs │ │ │ └── Type.hs │ │ ├── IntegrityCheck.hs │ │ ├── MainTerm.hs │ │ ├── Metadata.hs │ │ ├── Patch.hs │ │ ├── Path.hs │ │ ├── Path │ │ │ └── Parse.hs │ │ ├── ProjectPath.hs │ │ ├── PushBehavior.hs │ │ ├── Runtime.hs │ │ ├── Serialization.hs │ │ ├── ShortCausalHash.hs │ │ ├── SqliteCodebase.hs │ │ ├── SqliteCodebase │ │ │ ├── Branch │ │ │ │ └── Cache.hs │ │ │ ├── Conversions.hs │ │ │ ├── Migrations.hs │ │ │ ├── Migrations │ │ │ │ ├── Helpers.hs │ │ │ │ ├── MigrateSchema11To12.hs │ │ │ │ ├── MigrateSchema16To17.hs │ │ │ │ ├── MigrateSchema1To2.hs │ │ │ │ ├── MigrateSchema1To2 │ │ │ │ │ └── DbHelpers.hs │ │ │ │ ├── MigrateSchema3To4.hs │ │ │ │ ├── MigrateSchema5To6.hs │ │ │ │ ├── MigrateSchema6To7.hs │ │ │ │ └── MigrateSchema7To8.hs │ │ │ ├── Operations.hs │ │ │ ├── Paths.hs │ │ │ └── SyncEphemeral.hs │ │ ├── TermEdit.hs │ │ ├── TermEdit │ │ │ └── Typing.hs │ │ ├── Type.hs │ │ ├── TypeEdit.hs │ │ ├── UniqueTypeGuidLookup.hs │ │ └── Verbosity.hs │ │ ├── CodebasePath.hs │ │ ├── DataDeclaration │ │ └── Dependencies.hs │ │ ├── FileParsers.hs │ │ ├── Hashing │ │ └── V2 │ │ │ └── Convert.hs │ │ ├── KindInference.hs │ │ ├── KindInference │ │ ├── Constraint │ │ │ ├── Context.hs │ │ │ ├── Pretty.hs │ │ │ ├── Provenance.hs │ │ │ ├── Solved.hs │ │ │ ├── TypeProvenance.hs │ │ │ └── Unsolved.hs │ │ ├── Error.hs │ │ ├── Error │ │ │ └── Pretty.hs │ │ ├── Generate.hs │ │ ├── Generate │ │ │ └── Monad.hs │ │ ├── Solve.hs │ │ ├── Solve │ │ │ └── Monad.hs │ │ └── UVar.hs │ │ ├── Parsers.hs │ │ ├── PatternMatchCoverage.hs │ │ ├── PatternMatchCoverage │ │ ├── Class.hs │ │ ├── Constraint.hs │ │ ├── Desugar.hs │ │ ├── EffectHandler.hs │ │ ├── GrdTree.hs │ │ ├── IntervalSet.hs │ │ ├── ListPat.hs │ │ ├── Literal.hs │ │ ├── NormalizedConstraints.hs │ │ ├── PmGrd.hs │ │ ├── PmLit.hs │ │ ├── Pretty.hs │ │ ├── Solve.hs │ │ └── UFMap.hs │ │ ├── PrettyPrintEnv.hs │ │ ├── PrettyPrintEnv │ │ ├── FQN.hs │ │ ├── MonadPretty.hs │ │ ├── Names.hs │ │ └── Util.hs │ │ ├── PrettyPrintEnvDecl.hs │ │ ├── PrettyPrintEnvDecl │ │ ├── Names.hs │ │ └── Sqlite.hs │ │ ├── PrintError.hs │ │ ├── Result.hs │ │ ├── Share │ │ └── Types.hs │ │ ├── Syntax │ │ ├── DeclParser.hs │ │ ├── DeclPrinter.hs │ │ ├── FileParser.hs │ │ ├── FilePrinter.hs │ │ ├── NamePrinter.hs │ │ ├── Precedence.hs │ │ ├── TermParser.hs │ │ ├── TermPrinter.hs │ │ ├── TypeParser.hs │ │ └── TypePrinter.hs │ │ ├── Typechecker.hs │ │ ├── Typechecker │ │ ├── Components.hs │ │ ├── Context.hs │ │ ├── Extractor.hs │ │ ├── TypeError.hs │ │ ├── TypeLookup.hs │ │ └── TypeVar.hs │ │ ├── UnisonFile.hs │ │ ├── UnisonFile │ │ ├── Env.hs │ │ ├── Names.hs │ │ ├── Summary.hs │ │ └── Type.hs │ │ └── Util │ │ ├── CycleTable.hs │ │ ├── CyclicEq.hs │ │ ├── CyclicOrd.hs │ │ ├── EnumContainers.hs │ │ ├── Exception.hs │ │ ├── Logger.hs │ │ ├── Pretty │ │ └── MegaParsec.hs │ │ ├── RefPromise.hs │ │ ├── Star2.hs │ │ ├── TQueue.hs │ │ ├── Text.hs │ │ ├── Text │ │ └── Pattern.hs │ │ └── TransitiveClosure.hs ├── tests │ ├── Suite.hs │ └── Unison │ │ ├── Core │ │ └── Test │ │ │ └── Name.hs │ │ └── Test │ │ ├── ABT.hs │ │ ├── Codebase │ │ ├── Branch.hs │ │ ├── Causal.hs │ │ └── Path.hs │ │ ├── CodebaseInit.hs │ │ ├── Common.hs │ │ ├── DataDeclaration.hs │ │ ├── Referent.hs │ │ ├── Syntax │ │ ├── FileParser.hs │ │ ├── TermParser.hs │ │ └── TypePrinter.hs │ │ ├── Term.hs │ │ ├── Type.hs │ │ ├── Typechecker.hs │ │ ├── Typechecker │ │ ├── Components.hs │ │ ├── Context.hs │ │ └── TypeError.hs │ │ ├── Util │ │ ├── Pretty.hs │ │ ├── Relation.hs │ │ └── Text.hs │ │ └── Var.hs └── unison-parser-typechecker.cabal ├── scheme-libs └── racket │ ├── unison-runtime.rkt │ └── unison │ ├── .gitignore │ ├── Readme.md │ ├── boot.ss │ ├── bytes-nat.rkt │ ├── bytevector.ss │ ├── chunked-bytes.rkt │ ├── chunked-seq.rkt │ ├── concurrent.ss │ ├── core.ss │ ├── curry.rkt │ ├── data.ss │ ├── gzip.rkt │ ├── info.rkt │ ├── murmurhash.rkt │ ├── network-utils.rkt │ ├── pattern.rkt │ ├── pem.rkt │ ├── primops-generated.rkt │ ├── primops.ss │ ├── primops │ ├── array.rkt │ ├── bytes.rkt │ ├── concurrent.rkt │ ├── crypto.rkt │ ├── io-handles.rkt │ ├── io.rkt │ ├── list.rkt │ ├── math.rkt │ ├── misc.rkt │ ├── pattern.rkt │ ├── ref.rkt │ ├── tcp.rkt │ ├── text.rkt │ ├── tls.rkt │ ├── udp.rkt │ └── universal.rkt │ ├── sandbox.rkt │ ├── string-search.rkt │ ├── tests │ ├── chunked-bytes.rkt │ ├── chunked-seq.rkt │ ├── pattern.rkt │ ├── string-search.rkt │ └── vector-trie.rkt │ ├── vector-trie.rkt │ └── zlib.rkt ├── scripts ├── check-formatting ├── check.sh ├── get-share-hash.sh ├── install-hooks.bash ├── make-release.sh ├── pre-commit.bash ├── pre-push.bash ├── test.sh ├── toucher.sh └── unisonloop.sh ├── stack.yaml ├── stack.yaml.lock ├── unison-cli-integration ├── integration-tests │ ├── IntegrationTests │ │ ├── ArgumentParsing.hs │ │ ├── print.u │ │ ├── transcript.md │ │ └── transcript.output.md │ └── Suite.hs ├── package.yaml └── unison-cli-integration.cabal ├── unison-cli-main ├── LICENSE ├── package.yaml ├── unison-cli-main.cabal └── unison │ ├── Main.hs │ └── Version.hs ├── unison-cli ├── LICENSE ├── package.yaml ├── src │ ├── ArgParse.hs │ ├── Compat.hs │ ├── Stats.hs │ ├── System │ │ └── Path.hs │ └── Unison │ │ ├── Auth │ │ ├── CredentialFile.hs │ │ ├── CredentialManager.hs │ │ ├── Discovery.hs │ │ ├── HTTPClient.hs │ │ ├── Tokens.hs │ │ ├── Types.hs │ │ └── UserInfo.hs │ │ ├── Cli │ │ ├── DownloadUtils.hs │ │ ├── MergeTypes.hs │ │ ├── Monad.hs │ │ ├── MonadUtils.hs │ │ ├── NameResolutionUtils.hs │ │ ├── NamesUtils.hs │ │ ├── Pretty.hs │ │ ├── ProjectUtils.hs │ │ ├── ServantClientUtils.hs │ │ ├── Share │ │ │ ├── Projects.hs │ │ │ └── Projects │ │ │ │ └── Types.hs │ │ ├── TypeCheck.hs │ │ ├── UniqueTypeGuidLookup.hs │ │ └── UpdateUtils.hs │ │ ├── Codebase │ │ ├── Editor │ │ │ ├── AuthorInfo.hs │ │ │ ├── HandleInput.hs │ │ │ ├── HandleInput │ │ │ │ ├── AddRun.hs │ │ │ │ ├── AuthLogin.hs │ │ │ │ ├── Branch.hs │ │ │ │ ├── BranchRename.hs │ │ │ │ ├── Branches.hs │ │ │ │ ├── CommitMerge.hs │ │ │ │ ├── CommitUpgrade.hs │ │ │ │ ├── DebugDefinition.hs │ │ │ │ ├── DebugFoldRanges.hs │ │ │ │ ├── DebugSynhashTerm.hs │ │ │ │ ├── DeleteBranch.hs │ │ │ │ ├── DeleteNamespace.hs │ │ │ │ ├── DeleteProject.hs │ │ │ │ ├── Dependencies.hs │ │ │ │ ├── Dependents.hs │ │ │ │ ├── EditDependents.hs │ │ │ │ ├── EditNamespace.hs │ │ │ │ ├── FindAndReplace.hs │ │ │ │ ├── FormatFile.hs │ │ │ │ ├── Global.hs │ │ │ │ ├── InstallLib.hs │ │ │ │ ├── LSPDebug.hs │ │ │ │ ├── Load.hs │ │ │ │ ├── Ls.hs │ │ │ │ ├── Merge2.hs │ │ │ │ ├── MoveAll.hs │ │ │ │ ├── MoveBranch.hs │ │ │ │ ├── MoveTerm.hs │ │ │ │ ├── MoveType.hs │ │ │ │ ├── Names.hs │ │ │ │ ├── NamespaceDependencies.hs │ │ │ │ ├── NamespaceDiffUtils.hs │ │ │ │ ├── ProjectClone.hs │ │ │ │ ├── ProjectCreate.hs │ │ │ │ ├── ProjectRename.hs │ │ │ │ ├── ProjectSwitch.hs │ │ │ │ ├── Projects.hs │ │ │ │ ├── Pull.hs │ │ │ │ ├── Push.hs │ │ │ │ ├── Reflogs.hs │ │ │ │ ├── ReleaseDraft.hs │ │ │ │ ├── Run.hs │ │ │ │ ├── RuntimeUtils.hs │ │ │ │ ├── ShowDefinition.hs │ │ │ │ ├── SyncV2.hs │ │ │ │ ├── TermResolution.hs │ │ │ │ ├── Tests.hs │ │ │ │ ├── Todo.hs │ │ │ │ ├── UI.hs │ │ │ │ ├── Update.hs │ │ │ │ ├── Update2.hs │ │ │ │ └── Upgrade.hs │ │ │ ├── Input.hs │ │ │ ├── Output.hs │ │ │ ├── Output │ │ │ │ ├── BranchDiff.hs │ │ │ │ ├── DumpNamespace.hs │ │ │ │ └── PushPull.hs │ │ │ ├── Slurp.hs │ │ │ ├── SlurpComponent.hs │ │ │ ├── SlurpResult.hs │ │ │ ├── StructuredArgument.hs │ │ │ ├── UCMVersion.hs │ │ │ └── UriParser.hs │ │ ├── Transcript.hs │ │ ├── Transcript │ │ │ ├── Parser.hs │ │ │ └── Runner.hs │ │ └── Watch.hs │ │ ├── CommandLine.hs │ │ ├── CommandLine │ │ ├── BranchRelativePath.hs │ │ ├── Completion.hs │ │ ├── DisplayValues.hs │ │ ├── FZFResolvers.hs │ │ ├── FuzzySelect.hs │ │ ├── Helpers.hs │ │ ├── InputPattern.hs │ │ ├── InputPatterns.hs │ │ ├── Main.hs │ │ ├── OutputMessages.hs │ │ ├── Types.hs │ │ └── Welcome.hs │ │ ├── LSP.hs │ │ ├── LSP │ │ ├── CancelRequest.hs │ │ ├── CodeAction.hs │ │ ├── CodeLens.hs │ │ ├── Commands.hs │ │ ├── Completion.hs │ │ ├── Configuration.hs │ │ ├── Conversions.hs │ │ ├── Diagnostics.hs │ │ ├── FileAnalysis.hs │ │ ├── FileAnalysis │ │ │ └── UnusedBindings.hs │ │ ├── FoldingRange.hs │ │ ├── Formatting.hs │ │ ├── GoToDefinition.hs │ │ ├── HandlerUtils.hs │ │ ├── Hover.hs │ │ ├── NotificationHandlers.hs │ │ ├── Orphans.hs │ │ ├── Queries.hs │ │ ├── Types.hs │ │ ├── UCMWorker.hs │ │ ├── Util │ │ │ ├── IntersectionMap.hs │ │ │ └── Signal.hs │ │ └── VFS.hs │ │ ├── Main.hs │ │ ├── Share │ │ ├── Codeserver.hs │ │ ├── ExpectedHashMismatches.hs │ │ ├── Sync.hs │ │ ├── Sync │ │ │ └── Types.hs │ │ └── SyncV2.hs │ │ ├── Util │ │ └── HTTP.hs │ │ └── Version.hs ├── tests │ ├── Main.hs │ └── Unison │ │ └── Test │ │ ├── ClearCache.hs │ │ ├── Cli │ │ └── Monad.hs │ │ ├── LSP.hs │ │ ├── Ucm.hs │ │ └── UriParser.hs ├── transcripts │ └── Transcripts.hs └── unison-cli.cabal ├── unison-core ├── LICENSE ├── package.yaml ├── src │ └── Unison │ │ ├── ABT.hs │ │ ├── ABT │ │ └── Normalized.hs │ │ ├── Blank.hs │ │ ├── ConstructorReference.hs │ │ ├── ConstructorType.hs │ │ ├── DataDeclaration.hs │ │ ├── DataDeclaration │ │ ├── ConstructorId.hs │ │ ├── Names.hs │ │ └── Records.hs │ │ ├── DeclNameLookup.hs │ │ ├── HashQualified.hs │ │ ├── HashQualifiedPrime.hs │ │ ├── Hashable.hs │ │ ├── Kind.hs │ │ ├── LabeledDependency.hs │ │ ├── Name.hs │ │ ├── Name │ │ ├── Forward.hs │ │ └── Internal.hs │ │ ├── Names.hs │ │ ├── Names │ │ ├── ResolutionResult.hs │ │ └── ResolvesTo.hs │ │ ├── NamesWithHistory.hs │ │ ├── Pattern.hs │ │ ├── Position.hs │ │ ├── Project.hs │ │ ├── Reference.hs │ │ ├── Referent.hs │ │ ├── ReferentPrime.hs │ │ ├── Settings.hs │ │ ├── Symbol.hs │ │ ├── Term.hs │ │ ├── Type.hs │ │ ├── Type │ │ └── Names.hs │ │ ├── Util │ │ ├── Components.hs │ │ ├── Conflicted.hs │ │ ├── Defn.hs │ │ ├── Defns.hs │ │ └── Nametree.hs │ │ ├── Var.hs │ │ └── WatchKind.hs ├── test │ └── Main.hs └── unison-core1.cabal ├── unison-hashing-v2 ├── package.yaml ├── src │ └── Unison │ │ └── Hashing │ │ ├── V2.hs │ │ └── V2 │ │ ├── ABT.hs │ │ ├── Branch.hs │ │ ├── Causal.hs │ │ ├── ConstructorId.hs │ │ ├── DataDeclaration.hs │ │ ├── Kind.hs │ │ ├── NameSegment.hs │ │ ├── Patch.hs │ │ ├── Pattern.hs │ │ ├── Reference.hs │ │ ├── Reference │ │ └── Util.hs │ │ ├── Referent.hs │ │ ├── Term.hs │ │ ├── TermEdit.hs │ │ ├── Tokenizable.hs │ │ ├── Type.hs │ │ └── TypeEdit.hs └── unison-hashing-v2.cabal ├── unison-merge ├── package.yaml ├── src │ └── Unison │ │ ├── Merge.hs │ │ └── Merge │ │ ├── CombineDiffs.hs │ │ ├── DeclCoherencyCheck.hs │ │ ├── Diff.hs │ │ ├── DiffOp.hs │ │ ├── EitherWay.hs │ │ ├── EitherWayI.hs │ │ ├── FindConflictedAlias.hs │ │ ├── HumanDiffOp.hs │ │ ├── Internal │ │ └── Types.hs │ │ ├── Libdeps.hs │ │ ├── Mergeblob0.hs │ │ ├── Mergeblob1.hs │ │ ├── Mergeblob2.hs │ │ ├── Mergeblob3.hs │ │ ├── Mergeblob4.hs │ │ ├── Mergeblob5.hs │ │ ├── PartialDeclNameLookup.hs │ │ ├── PartitionCombinedDiffs.hs │ │ ├── Rename.hs │ │ ├── Synhash.hs │ │ ├── Synhashed.hs │ │ ├── ThreeWay.hs │ │ ├── TwoDiffOps.hs │ │ ├── TwoOrThreeWay.hs │ │ ├── TwoWay.hs │ │ ├── TwoWayI.hs │ │ ├── Unconflicts.hs │ │ └── Updated.hs └── unison-merge.cabal ├── unison-runtime ├── LICENSE ├── package.yaml ├── src │ └── Unison │ │ ├── Codebase │ │ └── Execute.hs │ │ └── Runtime │ │ ├── ANF.hs │ │ ├── ANF │ │ ├── Optimize.hs │ │ ├── Rehash.hs │ │ └── Serialize.hs │ │ ├── Array.hs │ │ ├── Builtin.hs │ │ ├── Builtin │ │ └── Types.hs │ │ ├── Crypto │ │ └── Rsa.hs │ │ ├── Debug.hs │ │ ├── Decompile.hs │ │ ├── Exception.hs │ │ ├── Foreign.hs │ │ ├── Foreign │ │ ├── Function.hs │ │ └── Function │ │ │ └── Type.hs │ │ ├── IOSource.hs │ │ ├── Interface.hs │ │ ├── MCode.hs │ │ ├── MCode │ │ └── Serialize.hs │ │ ├── Machine.hs │ │ ├── Machine │ │ ├── Primops.hs │ │ └── Types.hs │ │ ├── Pattern.hs │ │ ├── Serialize.hs │ │ ├── SparseVector.hs │ │ ├── Stack.hs │ │ ├── TypeTags.hs │ │ ├── Vector.hs │ │ └── docs.markdown ├── tests │ ├── Suite.hs │ └── Unison │ │ └── Test │ │ ├── Common.hs │ │ ├── Gen.hs │ │ ├── Runtime │ │ ├── ANF.hs │ │ ├── ANF │ │ │ └── Serialization.hs │ │ ├── Crypto │ │ │ └── Rsa.hs │ │ ├── MCode.hs │ │ └── MCode │ │ │ └── Serialization.hs │ │ └── UnisonSources.hs └── unison-runtime.cabal ├── unison-share-api ├── README.md ├── package.yaml ├── src │ └── Unison │ │ ├── Server │ │ ├── Backend.hs │ │ ├── Backend │ │ │ └── DefinitionDiff.hs │ │ ├── CodebaseServer.hs │ │ ├── Doc.hs │ │ ├── Doc │ │ │ ├── AsHtml.hs │ │ │ └── Markdown │ │ │ │ ├── Render.hs │ │ │ │ └── Types.hs │ │ ├── Errors.hs │ │ ├── Local.hs │ │ ├── Local │ │ │ ├── Definitions.hs │ │ │ └── Endpoints │ │ │ │ ├── Current.hs │ │ │ │ ├── DefinitionSummary.hs │ │ │ │ ├── FuzzyFind.hs │ │ │ │ ├── GetDefinitions.hs │ │ │ │ ├── NamespaceDetails.hs │ │ │ │ ├── NamespaceListing.hs │ │ │ │ ├── Projects.hs │ │ │ │ ├── Projects │ │ │ │ ├── Queries.hs │ │ │ │ └── Types.hs │ │ │ │ └── UCM.hs │ │ ├── NameSearch.hs │ │ ├── NameSearch │ │ │ ├── FromNames.hs │ │ │ └── Sqlite.hs │ │ ├── Orphans.hs │ │ ├── QueryResult.hs │ │ ├── SearchResult.hs │ │ ├── SearchResultPrime.hs │ │ ├── Syntax.hs │ │ └── Types.hs │ │ ├── Sync │ │ ├── API.hs │ │ ├── Common.hs │ │ ├── EntityValidation.hs │ │ └── Types.hs │ │ ├── SyncV2 │ │ ├── API.hs │ │ └── Types.hs │ │ └── Util │ │ ├── Find.hs │ │ └── Servant │ │ └── CBOR.hs ├── tests │ ├── Main.hs │ └── Unison │ │ └── Test │ │ └── Sync │ │ ├── Gen.hs │ │ └── Roundtrip.hs └── unison-share-api.cabal ├── unison-share-projects-api ├── README.md ├── package.yaml ├── src │ └── Unison │ │ └── Share │ │ └── API │ │ ├── Hash.hs │ │ └── Projects.hs └── unison-share-projects-api.cabal ├── unison-src ├── Base.u ├── base58.u ├── basics.u ├── builtin-tests │ ├── Readme.md │ ├── base.md │ ├── interpreter-tests.output.md │ ├── interpreter-tests.sh │ ├── interpreter-tests.tpl.md │ ├── jit-tests.output.md │ ├── jit-tests.sh │ ├── jit-tests.tpl.md │ └── udp-tests.u ├── demo │ ├── 1.u │ ├── 2.u │ └── 3.u ├── errors │ ├── 407.u │ ├── X-array.u │ ├── abort-ability-checks-against-pure.u │ ├── all-errors.u │ ├── check-for-regressions │ │ ├── and.u │ │ ├── app-polymorphic.u │ │ ├── app.u │ │ ├── applying-non-function.u │ │ ├── casebody.u │ │ ├── caseguard.u │ │ ├── casepattern.u │ │ ├── ifcond.u │ │ ├── ifelse.u │ │ ├── lens.u │ │ ├── not-and.u │ │ ├── not-and0.u │ │ ├── not-caseguard.u │ │ ├── not-caseguard2.u │ │ ├── not-or.u │ │ ├── not-vector.u │ │ ├── or.u │ │ └── vector.u │ ├── compiler-bug.u │ ├── cyclic-unguarded.u │ ├── effect-inference1.u │ ├── effect_unknown_type.uu │ ├── empty-block.u │ ├── ex1.u │ ├── fix745.u │ ├── handle-inference.u │ ├── handler-coverage-checking.uu │ ├── id.u │ ├── io-effect.u │ ├── io-state1.u │ ├── map-traverse3.u │ ├── mismatched-braces.u │ ├── need-nominal-type.uu │ ├── poor-error-message │ │ ├── ability-check-fail-by-calling-wrong-function.u │ │ ├── doesnt-match-annotation.u │ │ ├── function-calls.u │ │ ├── function-calls1.u │ │ ├── function-calls2.u │ │ ├── function-calls3.u │ │ ├── handle.u │ │ ├── handler-ex.u │ │ ├── mismatched-case-result-types.u │ │ ├── notaguard.u │ │ ├── overapplied-data-constructor-loc.u │ │ ├── pattern-case-location.u │ │ ├── pattern-matching-1.u │ │ └── tdnr-demo.u │ ├── rank2a.u │ ├── seq-concat-constant-length.u │ ├── state4.u │ ├── tdnr.u │ ├── tdnr2.u │ ├── tdnr3.u │ ├── term-functor-inspired │ │ ├── effect1.u │ │ ├── if-body-mismatch.u │ │ ├── if-cond-not-bool.u │ │ └── mismatched-case-result-types.u │ ├── type-apply.u │ ├── type-functor-inspired │ │ ├── app2.u │ │ ├── arrow1.u │ │ ├── effect2.u │ │ ├── forall-arrow.u │ │ ├── forall-arrow2.u │ │ ├── forall-arrow3.u │ │ ├── need-nonstructural-types.uu │ │ ├── parens.u │ │ ├── subtuple.u │ │ ├── synthesizeApp.u │ │ ├── tuple.u │ │ ├── tuple2.u │ │ └── unit.u │ ├── unexpected-loop.u │ ├── unresolved-symbol-1.u │ └── unsound-cont.u ├── example-errors.u ├── parser-tests │ ├── GenerateErrors.hs │ ├── empty-match-list.message.txt │ ├── empty-match-list.u │ ├── if-without-condition.message.txt │ └── if-without-condition.u ├── remote-api.u ├── remote.u ├── tests │ ├── 324.u │ ├── 344.uu │ ├── 514.u │ ├── 595.u │ ├── 868.u │ ├── 868.ur │ ├── a-tale-of-two-optionals.u │ ├── ability-inference-fail.uu │ ├── ability-keyword.u │ ├── abort.u │ ├── ask-inferred.u │ ├── boolean-ops-in-sequence.u │ ├── builtin-arity-0-evaluation.u │ ├── builtin-arity-0-evaluation.ur │ ├── caseguard.u │ ├── cce.u │ ├── cce.ur │ ├── compose-inference.u │ ├── console.u │ ├── console1.u │ ├── data-references-builtins.u │ ├── delay.u │ ├── delay_parse.u │ ├── effect-instantiation.u │ ├── effect-instantiation2.u │ ├── effect1.u │ ├── empty-above-the-fold.u │ ├── fib4.ur │ ├── fix1185.u │ ├── fix1640.u │ ├── fix1695.u │ ├── fix1779.u │ ├── fix528.u │ ├── fix528.ur │ ├── fix5507.md │ ├── fix5507.sh │ ├── fix739.u │ ├── force.u │ ├── guard-boolean-operators.u │ ├── handler-stacking.u │ ├── hang.u │ ├── id.u │ ├── if.u │ ├── imports.u │ ├── imports2.u │ ├── inner-lambda1.u │ ├── inner-lambda2.u │ ├── io-state2.u │ ├── io-state3.u │ ├── keyword-parse.u │ ├── lambda-closing-over-effectful-fn.u │ ├── lambda-closing-over-effectful-fn.ur │ ├── links.u │ ├── links.ur │ ├── map-traverse.u │ ├── map-traverse2.u │ ├── mergesort.u │ ├── methodical │ │ ├── abilities.u │ │ ├── abilities.ur │ │ ├── apply-constructor.u │ │ ├── apply-constructor.ur │ │ ├── apply.u │ │ ├── apply.ur │ │ ├── builtin-nat-to-float.u │ │ ├── builtin-nat-to-float.ur │ │ ├── builtins.u │ │ ├── cycle-minimize.u │ │ ├── dots.u │ │ ├── dots.ur │ │ ├── empty.u │ │ ├── empty2.u │ │ ├── empty3.u │ │ ├── exponential.u │ │ ├── exponential.ur │ │ ├── float.u │ │ ├── float.ur │ │ ├── hyperbolic.u │ │ ├── hyperbolic.ur │ │ ├── int.u │ │ ├── int.ur │ │ ├── let.u │ │ ├── let.ur │ │ ├── literals.u │ │ ├── literals.ur │ │ ├── loop.u │ │ ├── nat.u │ │ ├── nat.ur │ │ ├── nesting.u │ │ ├── overapply-ability.u │ │ ├── overapply-ability.ur │ │ ├── parens.u │ │ ├── pattern-matching.u │ │ ├── pattern-matching.ur │ │ ├── power.u │ │ ├── power.ur │ │ ├── rank2.u │ │ ├── rounding.u │ │ ├── rounding.ur │ │ ├── scopedtypevars.u │ │ ├── semis.u │ │ ├── semis.ur │ │ ├── trig.u │ │ ├── trig.ur │ │ ├── universals.u │ │ ├── universals.ur │ │ └── wildcardimports.u │ ├── multiple-effects.u │ ├── one-liners.uu │ ├── parenthesized-blocks.u │ ├── parenthesized-blocks.ur │ ├── pattern-match-seq.u │ ├── pattern-match-seq.ur │ ├── pattern-matching.u │ ├── pattern-matching.ur │ ├── pattern-matching2.u │ ├── pattern-typing-bug.u │ ├── pattern-typing-bug.ur │ ├── pattern-weirdness.u │ ├── pattern-weirdness.ur │ ├── quote-parse-bug.uu │ ├── r0.u │ ├── r1.u │ ├── r10.u │ ├── r11.u │ ├── r12.u │ ├── r13.u │ ├── r14.u │ ├── r2.u │ ├── r3.u │ ├── r4negate.u │ ├── r4x.u │ ├── r5.u │ ├── r6.u │ ├── r7.0.u │ ├── r7.1.u │ ├── r7.2.u │ ├── r8.u │ ├── r9.u │ ├── rainbow.u │ ├── records.u │ ├── runtime-crash.uu │ ├── sequence-at-0.u │ ├── sequence-literal-argument-parsing.u │ ├── sequence-literal.u │ ├── soe.u │ ├── soe2.u │ ├── spurious-ability-fail-underapply.u │ ├── spurious-ability-fail.u │ ├── state1.u │ ├── state1a.u │ ├── state2.u │ ├── state2a-min.u │ ├── state2a-min.ur │ ├── state2a.u │ ├── state2a.uu │ ├── state2b-min.u │ ├── state2b-min.ur │ ├── state2b.u │ ├── state3.u │ ├── state4.u │ ├── state4.ur │ ├── state4a.u │ ├── state4a.ur │ ├── stream.u │ ├── stream2.uu │ ├── stream3.uu │ ├── suffix-resolve.u │ ├── tdnr.u │ ├── tdnr2.u │ ├── tdnr3.u │ ├── tdnr4.u │ ├── text-escaping.u │ ├── text-escaping.ur │ ├── text-pattern.u │ ├── text-pattern.ur │ ├── tictactoe.u │ ├── tictactoe0-array-oob1.u │ ├── tictactoe0-npe.u │ ├── tictactoe0.u │ ├── tictactoe2.u │ ├── tuple.u │ ├── tuple.ur │ ├── type-application.u │ ├── underscore-parsing.u │ ├── ungeneralize-bug.uu │ ├── unique.u │ └── void.u ├── transcripts-manual │ ├── README.md │ ├── benchmarks.md │ ├── benchmarks │ │ ├── array-sort.u │ │ ├── each.u │ │ ├── fibonacci.u │ │ ├── listfilter.u │ │ ├── listmap.u │ │ ├── map.u │ │ ├── natmap.u │ │ ├── output.bench.txt │ │ ├── random.u │ │ ├── simpleloop.u │ │ ├── stm.u │ │ └── tmap.u │ ├── docs.to-html.md │ ├── docs.to-html.output.md │ ├── docs.to-html │ │ ├── direct │ │ │ └── doc.html │ │ └── pretty │ │ │ └── deeply │ │ │ └── nested │ │ │ └── doc.html │ ├── gen-racket-libs.md │ ├── gen-racket-libs.output.md │ ├── remote-tab-completion.md │ ├── remote-tab-completion.output.md │ ├── rewrites.md │ ├── rewrites.output.md │ └── scheme.md ├── transcripts-round-trip │ ├── docTest2.u │ ├── ex2.u │ ├── main.md │ ├── main.output.md │ ├── reparses-with-same-hash.u │ └── reparses.u ├── transcripts-using-base │ ├── README │ ├── _base.md │ ├── _base.output.md │ ├── all-base-hashes.md │ ├── all-base-hashes.output.md │ ├── base.u │ ├── binary-encoding-nats.md │ ├── binary-encoding-nats.output.md │ ├── codeops.md │ ├── codeops.output.md │ ├── doc.md │ ├── doc.md.files │ │ └── syntax.u │ ├── doc.output.md │ ├── failure-tests.md │ ├── failure-tests.output.md │ ├── fix-2805.md │ ├── fix-2805.output.md │ ├── fix2049.md │ ├── fix2049.output.md │ ├── fix2158-1.md │ ├── fix2158-1.output.md │ ├── fix2297.md │ ├── fix2297.output.md │ ├── fix2358.md │ ├── fix2358.output.md │ ├── fix2944.md │ ├── fix2944.output.md │ ├── fix3166.md │ ├── fix3166.output.md │ ├── fix3542.md │ ├── fix3542.output.md │ ├── fix3939.md │ ├── fix3939.output.md │ ├── fix4746.md │ ├── fix4746.output.md │ ├── fix5129.md │ ├── fix5129.output.md │ ├── fix5178.md │ ├── fix5178.output.md │ ├── hashing.md │ ├── hashing.output.md │ ├── mvar.md │ ├── mvar.output.md │ ├── nat-coersion.md │ ├── nat-coersion.output.md │ ├── net.md │ ├── net.output.md │ ├── random-deserial.md │ ├── random-deserial.output.md │ ├── ref-promise.md │ ├── ref-promise.output.md │ ├── replacements.md │ ├── replacements.output.md │ ├── serial-test-00.md │ ├── serial-test-00.output.md │ ├── serial-test-01.md │ ├── serial-test-01.output.md │ ├── serial-test-02.md │ ├── serial-test-02.output.md │ ├── serial-test-03.md │ ├── serial-test-03.output.md │ ├── serial-test-04.md │ ├── serial-test-04.output.md │ ├── serialized-cases │ │ ├── case-00.out │ │ ├── case-00.v4.hash │ │ ├── case-00.v4.ser │ │ ├── case-00.v5.hash │ │ ├── case-00.v5.ser │ │ ├── case-01.out │ │ ├── case-01.v4.hash │ │ ├── case-01.v4.ser │ │ ├── case-01.v5.hash │ │ ├── case-01.v5.ser │ │ ├── case-02.out │ │ ├── case-02.v4.hash │ │ ├── case-02.v4.ser │ │ ├── case-02.v5.hash │ │ ├── case-02.v5.ser │ │ ├── case-03.out │ │ ├── case-03.v4.hash │ │ ├── case-03.v4.ser │ │ ├── case-03.v5.hash │ │ ├── case-03.v5.ser │ │ ├── case-04.out │ │ ├── case-04.v4.hash │ │ ├── case-04.v4.ser │ │ ├── case-04.v5.hash │ │ └── case-04.v5.ser │ ├── stm.md │ ├── stm.output.md │ ├── thread.md │ ├── thread.output.md │ ├── tls.md │ ├── tls.output.md │ ├── utf8.md │ └── utf8.output.md └── transcripts │ ├── alias-many.md │ ├── alias-many.output.md │ ├── base_release_transcript.md │ ├── base_release_transcript.output.md │ ├── errors │ ├── code-block-parse-error.md │ ├── code-block-parse-error.output.md │ ├── dont-hide-unexpected-ucm-errors.md │ ├── dont-hide-unexpected-ucm-errors.output.md │ ├── dont-hide-unexpected-unison-errors.md │ ├── dont-hide-unexpected-unison-errors.output.md │ ├── info-string-parse-error.md │ ├── info-string-parse-error.output.md │ ├── invalid-api-requests.md │ ├── invalid-api-requests.output.md │ ├── missing-result-typed.md │ ├── missing-result-typed.output.md │ ├── missing-result.md │ ├── missing-result.output.md │ ├── no-abspath-in-ucm.md │ ├── no-abspath-in-ucm.output.md │ ├── obsolete-bug.md │ ├── obsolete-bug.output.md │ ├── obsolete-error-bug.md │ ├── obsolete-error-bug.output.md │ ├── ucm-hide-all-error.md │ ├── ucm-hide-all-error.output.md │ ├── ucm-hide-all.md │ ├── ucm-hide-all.output.md │ ├── ucm-hide-error.md │ ├── ucm-hide-error.output.md │ ├── ucm-hide.md │ ├── ucm-hide.output.md │ ├── unison-hide-all-error.md │ ├── unison-hide-all-error.output.md │ ├── unison-hide-all.md │ ├── unison-hide-all.output.md │ ├── unison-hide-error.md │ ├── unison-hide-error.output.md │ ├── unison-hide.md │ └── unison-hide.output.md │ ├── fix2840.md │ ├── fix2840.output.md │ ├── hello.md │ ├── hello.output.md │ ├── idempotent │ ├── abilities.md │ ├── ability-order-doesnt-affect-hash.md │ ├── add-run.md │ ├── add-test-watch-roundtrip.md │ ├── addupdatemessages.md │ ├── affine-handlers.md │ ├── alias-term.md │ ├── alias-type.md │ ├── anf-tests.md │ ├── any-extract.md │ ├── api-doc-rendering.md │ ├── api-find.md │ ├── api-getDefinition.md │ ├── api-list-projects-branches.md │ ├── api-list-projects-branches.output.md │ ├── api-namespace-details.md │ ├── api-namespace-list.md │ ├── api-summaries.md │ ├── blocks.md │ ├── boolean-op-pretty-print-2819.md │ ├── branch-command.md │ ├── branch-relative-path.md │ ├── bug-fix-4354.md │ ├── bug-strange-closure.md │ ├── bug.md │ ├── builtins-merge.md │ ├── builtins.md │ ├── builtins.output.md │ ├── bytesFromList.md │ ├── check763.md │ ├── check873.md │ ├── constructor-applied-to-unit.md │ ├── contrabilities.md │ ├── create-author.md │ ├── cycle-update-1.md │ ├── cycle-update-2.md │ ├── cycle-update-3.md │ ├── cycle-update-4.md │ ├── debug-definitions.md │ ├── debug-name-diffs.md │ ├── deep-names.md │ ├── definition-diff-api.md │ ├── delete-namespace-dependents-check.md │ ├── delete-namespace.md │ ├── delete-project-branch.md │ ├── delete-project.md │ ├── delete-silent.md │ ├── delete.md │ ├── dependents-dependencies-debugfile.md │ ├── destructuring-binds.md │ ├── diff-namespace.md │ ├── doc-formatting.md │ ├── doc-type-link-keywords.md │ ├── doc1.md │ ├── doc2.md │ ├── doc2markdown.md │ ├── dont-upgrade-refs-that-exist-in-old.md │ ├── duplicate-names.md │ ├── duplicate-term-detection.md │ ├── ed25519.md │ ├── edit-command.md │ ├── edit-dependents-command.md │ ├── edit-namespace.md │ ├── empty-namespaces.md │ ├── emptyCodebase.md │ ├── error-messages.md │ ├── escape-sequences.md │ ├── find-by-type.md │ ├── find-command.md │ ├── fix-1381-excess-propagate.md │ ├── fix-2258-if-as-list-element.md │ ├── fix-3982.md │ ├── fix-4536.md │ ├── fix-5267.md │ ├── fix-5301.md │ ├── fix-5312.md │ ├── fix-5320.md │ ├── fix-5323.md │ ├── fix-5326.md │ ├── fix-5340.md │ ├── fix-5354.md │ ├── fix-5357.md │ ├── fix-5369.md │ ├── fix-5374.md │ ├── fix-5380.md │ ├── fix-5402.md │ ├── fix-5427.md │ ├── fix-5433.md │ ├── fix-5446.md │ ├── fix-5464.md │ ├── fix-5489.md │ ├── fix-5525.md │ ├── fix-5575.md │ ├── fix-5604.md │ ├── fix-5612.md │ ├── fix-annotated-lambdas.md │ ├── fix-big-list-crash.md │ ├── fix-ls.md │ ├── fix-pattern-capture.md │ ├── fix1063.md │ ├── fix1327.md │ ├── fix1334.md │ ├── fix1390.md │ ├── fix1421.md │ ├── fix1532.md │ ├── fix1696.md │ ├── fix1709.md │ ├── fix1731.md │ ├── fix1800.md │ ├── fix1844.md │ ├── fix1926.md │ ├── fix2026.md │ ├── fix2027.md │ ├── fix2049.md │ ├── fix2053.md │ ├── fix2156.md │ ├── fix2167.md │ ├── fix2187.md │ ├── fix2231.md │ ├── fix2238.md │ ├── fix2244.md │ ├── fix2254.md │ ├── fix2268.md │ ├── fix2334.md │ ├── fix2344.md │ ├── fix2350.md │ ├── fix2353.md │ ├── fix2354.md │ ├── fix2355.md │ ├── fix2378.md │ ├── fix2423.md │ ├── fix2474.md │ ├── fix2628.md │ ├── fix2663.md │ ├── fix2693.md │ ├── fix2712.md │ ├── fix2795.md │ ├── fix2822.md │ ├── fix2826.md │ ├── fix2970.md │ ├── fix3037.md │ ├── fix3171.md │ ├── fix3196.md │ ├── fix3215.md │ ├── fix3244.md │ ├── fix3265.md │ ├── fix3424.md │ ├── fix3634.md │ ├── fix3678.md │ ├── fix3752.md │ ├── fix3773.md │ ├── fix3977.md │ ├── fix4172.md │ ├── fix4280.md │ ├── fix4397.md │ ├── fix4415.md │ ├── fix4424.md │ ├── fix4482.md │ ├── fix4498.md │ ├── fix4515.md │ ├── fix4528.md │ ├── fix4556.md │ ├── fix4592.md │ ├── fix4618.md │ ├── fix4711.md │ ├── fix4722.md │ ├── fix4731.md │ ├── fix4780.md │ ├── fix4898.md │ ├── fix5055.md │ ├── fix5076.md │ ├── fix5080.md │ ├── fix5141.md │ ├── fix5168.md │ ├── fix5337.md │ ├── fix5349.md │ ├── fix5419.md │ ├── fix5448.md │ ├── fix5506.md │ ├── fix5538.md │ ├── fix5566.md │ ├── fix614.md │ ├── fix689.md │ ├── fix693.md │ ├── fix845.md │ ├── fix849.md │ ├── fix942.md │ ├── fix987.md │ ├── formatter.md │ ├── fuzzy-options.md │ ├── generic-parse-errors.md │ ├── help.md │ ├── higher-rank.md │ ├── input-parse-errors.md │ ├── io-test-command.md │ ├── io.md │ ├── keyword-identifiers.md │ ├── kind-inference.md │ ├── lambdacase.md │ ├── lsp-fold-ranges.md │ ├── lsp-name-completion.md │ ├── merge.md │ ├── move-all.md │ ├── move-namespace.md │ ├── name-resolution.md │ ├── name-segment-escape.md │ ├── name-selection.md │ ├── name-test-sandbox-violators.md │ ├── names.md │ ├── namespace-deletion-regression.md │ ├── namespace-dependencies.md │ ├── namespace-directive.md │ ├── numbered-args.md │ ├── old-fold-right.md │ ├── pattern-match-coverage.md │ ├── pattern-pretty-print-2345.md │ ├── patternMatchTls.md │ ├── patterns.md │ ├── propagate.md │ ├── pull-errors.md │ ├── quad-handlers.md │ ├── records.md │ ├── reflog.md │ ├── release-draft-command.md │ ├── reset.md │ ├── resolution-failures.md │ ├── rsa.md │ ├── runtime-tests.md │ ├── scope-ref.md │ ├── suffixes.md │ ├── sum-type-update-conflicts.md │ ├── switch-command.md │ ├── tab-completion.md │ ├── tdnr.md │ ├── test-command.md │ ├── text-literals.md │ ├── textfind.md │ ├── todo-bug-builtins.md │ ├── todo.md │ ├── top-level-exceptions.md │ ├── transcript-parser-commands.md │ ├── type-deps.md │ ├── type-modifier-are-optional.md │ ├── undo.md │ ├── unique-type-churn.md │ ├── unitnamespace.md │ ├── universal-cmp.md │ ├── unsafe-coerce.md │ ├── update-ignores-lib-namespace.md │ ├── update-on-conflict.md │ ├── update-suffixifies-properly.md │ ├── update-term-aliases-in-different-ways.md │ ├── update-term-to-different-type.md │ ├── update-term-with-alias.md │ ├── update-term-with-dependent-to-different-type.md │ ├── update-term-with-dependent.md │ ├── update-term.md │ ├── update-test-to-non-test.md │ ├── update-test-watch-roundtrip.md │ ├── update-type-add-constructor.md │ ├── update-type-add-field.md │ ├── update-type-add-new-record.md │ ├── update-type-add-record-field.md │ ├── update-type-constructor-alias.md │ ├── update-type-delete-constructor-with-dependent.md │ ├── update-type-delete-constructor.md │ ├── update-type-delete-record-field.md │ ├── update-type-missing-constructor.md │ ├── update-type-nested-decl-aliases.md │ ├── update-type-no-op-record.md │ ├── update-type-stray-constructor-alias.md │ ├── update-type-stray-constructor.md │ ├── update-type-turn-constructor-into-smart-constructor.md │ ├── update-type-turn-non-record-into-record.md │ ├── update-type-with-dependent-term.md │ ├── update-type-with-dependent-type-to-different-kind.md │ ├── update-type-with-dependent-type.md │ ├── update-watch.md │ ├── upgrade-happy-path.md │ ├── upgrade-sad-path.md │ ├── upgrade-suffixifies-properly.md │ ├── upgrade-with-old-alias.md │ ├── view.md │ └── watch-expressions.md │ ├── no-hash-in-term-declaration.md │ ├── no-hash-in-term-declaration.output.md │ ├── pretty-print-libraries.md │ ├── pretty-print-libraries.output.md │ └── project-outputs │ ├── .github │ ├── ISSUE_TEMPLATE │ │ └── bug_report.output.md │ └── pull_request_template.output.md │ ├── comments-and-docs.output.md │ ├── docs │ ├── ability-typechecking.output.md │ ├── adding-builtins.output.md │ ├── branchless-scratch.output.md │ ├── branchless.output.md │ ├── codebase-editor-design.output.md │ ├── commandline-editor-dev.output.md │ ├── comments-and-docs.output.md │ ├── configuration.output.md │ ├── data-types.output.md │ ├── distributed-api-discussion-v1.output.md │ ├── distributed-garbage-collection.output.md │ ├── distributed-programming-rfc.output.md │ ├── github-actions-help.output.md │ ├── language-server.output.md │ ├── metadata.output.md │ ├── nix.output.md │ ├── publishing-library1.output.md │ ├── publishing-library2.output.md │ ├── publishing.output.md │ ├── release-steps.output.md │ ├── runtime-calling-conventions.output.md │ ├── sharing-code.output.md │ ├── testing.output.md │ └── type-declarations.output.md │ ├── publishing-library1.output.md │ ├── testing.output.md │ └── type-declarations.output.md ├── unison-syntax ├── package.yaml ├── src │ └── Unison │ │ ├── Lexer │ │ └── Pos.hs │ │ ├── Parser │ │ └── Ann.hs │ │ ├── Syntax │ │ ├── HashQualified.hs │ │ ├── HashQualifiedPrime.hs │ │ ├── Lexer.hs │ │ ├── Lexer │ │ │ ├── Token.hs │ │ │ └── Unison.hs │ │ ├── Name.hs │ │ ├── NameSegment.hs │ │ ├── Parser.hs │ │ ├── Parser │ │ │ ├── Doc.hs │ │ │ └── Doc │ │ │ │ └── Data.hs │ │ ├── Pattern.hs │ │ ├── ReservedWords.hs │ │ ├── ShortHash.hs │ │ └── Var.hs │ │ └── UnisonFile │ │ └── Error.hs ├── test │ ├── Main.hs │ └── Unison │ │ └── Test │ │ ├── Doc.hs │ │ └── Unison.hs └── unison-syntax.cabal ├── weeder.dhall └── yaks └── easytest ├── LICENSE ├── README.markdown ├── easytest.cabal ├── src └── EasyTest.hs └── tests └── Suite.hs /.editorconfig: -------------------------------------------------------------------------------- 1 | # Multi-editor style config: https://EditorConfig.org 2 | 3 | root = true 4 | 5 | [*] 6 | charset = utf-8 7 | end_of_line = lf 8 | indent_style = space 9 | insert_final_newline = true 10 | max_line_length = 120 11 | trim_trailing_whitespace = true 12 | 13 | [*.u] 14 | max_line_length = off 15 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | *.uc binary 3 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # Require approval from ucm team when editing repository workflows 2 | # This helps prevent users from sneaking in malicious changes to CI workflows. 3 | /.github/ @unisonweb/ucm 4 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: feature request 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.github/workflows/check-contributor.yaml: -------------------------------------------------------------------------------- 1 | name: Contributor signed CONTRIBUTORS.markdown 2 | 3 | on: 4 | pull_request: 5 | 6 | jobs: 7 | check-contributor: 8 | runs-on: ubuntu-24.04 9 | steps: 10 | - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 11 | with: 12 | sparse-checkout: CONTRIBUTORS.markdown 13 | - name: Look for @${{github.event.pull_request.user.login}} in CONTRIBUTORS.markdown 14 | shell: bash 15 | run: | 16 | echo "If this step fails, make sure you've added yourself to CONTRIBUTORS.markdown" 17 | echo "to acknowledge Unison's MIT license." 18 | 19 | egrep '\* .* \(@${{github.event.pull_request.user.login}}\)' \ 20 | CONTRIBUTORS.markdown 21 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Unison 2 | .unison* 3 | test-output 4 | unisonLocal.zip 5 | *.uc 6 | # Ignore all scratch files... 7 | *.u 8 | # Except those in unison-src 9 | !unison-src/**/*.u 10 | # And integration tests 11 | !unison-cli-integration/integration-tests/IntegrationTests/**/*.u 12 | 13 | # Auto-generated 14 | jit-tests.md 15 | interpreter-tests.md 16 | 17 | # Stack 18 | .stack-work 19 | .stack-work-hls 20 | 21 | # Cabal 22 | dist-newstyle 23 | 24 | # GHC 25 | *.hie 26 | *.prof 27 | *.prof.html 28 | *.hp 29 | *.ps 30 | *.profiterole.* 31 | /.direnv/ 32 | /.envrc 33 | 34 | # Mac developers 35 | **/.DS_Store 36 | /libb2.dylib 37 | 38 | # Nix 39 | result 40 | -------------------------------------------------------------------------------- /.ormolu: -------------------------------------------------------------------------------- 1 | infixl 8 ^? 2 | infixr 4 %%~, %~ 3 | infixl 3 <|> 4 | infixl 1 &, <&> 5 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "haskell.toolchain": { 3 | "cabal": "3.10.3.0", 4 | "hls": "2.8.0.0", 5 | "stack": "2.15.7" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM debian:stable 2 | 3 | RUN adduser --home /unison --disabled-password unison 4 | 5 | RUN apt-get update && \ 6 | apt-get install -y git libncurses5 less locales fzf && \ 7 | echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && \ 8 | dpkg-reconfigure --frontend=noninteractive locales && \ 9 | update-locale LANG=en_US.UTF-8 10 | 11 | 12 | COPY tmp/ucm/ucm /usr/local/bin/ucm 13 | COPY tmp/ucm/ui /usr/local/share/ucm 14 | 15 | ENV UCM_WEB_UI=/usr/local/share/ucm 16 | ENV UCM_PORT=8080 17 | ENV UCM_TOKEN=pub 18 | 19 | RUN chmod 555 /usr/local/bin/ucm 20 | 21 | EXPOSE 8080 22 | ENTRYPOINT ["/usr/local/bin/ucm"] 23 | CMD ["--codebase","/unison"] 24 | -------------------------------------------------------------------------------- /codebase2/codebase-sqlite-hashing-v2/src/U/Codebase/Branch/Hashing.hs: -------------------------------------------------------------------------------- 1 | module U.Codebase.Branch.Hashing 2 | ( hashBranch, 3 | hashBranchV3, 4 | ) 5 | where 6 | 7 | import U.Codebase.Branch (Branch) 8 | import U.Codebase.BranchV3 (BranchV3) 9 | import U.Codebase.HashTags 10 | import Unison.Hashing.V2 qualified as Hashing 11 | import Unison.Hashing.V2.Convert2 (convertBranchV3, v2ToH2Branch) 12 | 13 | hashBranch :: forall m. (Monad m) => Branch m -> m BranchHash 14 | hashBranch branch = 15 | BranchHash . Hashing.contentHash <$> v2ToH2Branch branch 16 | 17 | -- | Hash a V3 branch. 18 | hashBranchV3 :: BranchV3 m -> BranchHash 19 | hashBranchV3 = 20 | BranchHash . Hashing.contentHash . convertBranchV3 21 | -------------------------------------------------------------------------------- /codebase2/codebase-sqlite-hashing-v2/src/U/Codebase/Causal/Hashing.hs: -------------------------------------------------------------------------------- 1 | module U.Codebase.Causal.Hashing where 2 | 3 | import Data.Set 4 | import Data.Set qualified as Set 5 | import U.Codebase.HashTags (BranchHash (..), CausalHash (..)) 6 | import Unison.Hashing.V2 qualified as Hashing 7 | 8 | hashCausal :: BranchHash -> Set CausalHash -> CausalHash 9 | hashCausal branchHash ancestors = 10 | CausalHash . Hashing.contentHash $ 11 | Hashing.Causal 12 | { Hashing.branchHash = unBranchHash branchHash, 13 | Hashing.parents = Set.map unCausalHash ancestors 14 | } 15 | -------------------------------------------------------------------------------- /codebase2/codebase-sqlite/U/Codebase/Sqlite/ObjectType.hs: -------------------------------------------------------------------------------- 1 | module U.Codebase.Sqlite.ObjectType where 2 | 3 | import Unison.Sqlite (FromField (..), SQLData (SQLInteger), ToField (..)) 4 | 5 | -- | Don't reorder these, they are part of the database, 6 | -- and the ToField and FromField implementation currently 7 | -- depends on the derived Enum implementation. 8 | data ObjectType 9 | = TermComponent -- 0 10 | | DeclComponent -- 1 11 | | Namespace -- 2 12 | | Patch -- 3 13 | deriving (Eq, Ord, Show, Enum) 14 | 15 | instance ToField ObjectType where 16 | toField = SQLInteger . fromIntegral . fromEnum 17 | 18 | instance FromField ObjectType where 19 | fromField = fmap toEnum . fromField 20 | -------------------------------------------------------------------------------- /codebase2/codebase-sqlite/U/Codebase/Sqlite/Project.hs: -------------------------------------------------------------------------------- 1 | module U.Codebase.Sqlite.Project 2 | ( Project (..), 3 | ) 4 | where 5 | 6 | import U.Codebase.Sqlite.DbId (ProjectId) 7 | import Unison.Core.Orphans.Sqlite () 8 | import Unison.Core.Project (ProjectName) 9 | import Unison.Prelude 10 | import Unison.Sqlite (FromRow, ToRow) 11 | 12 | -- | A project. 13 | data Project = Project 14 | { projectId :: !ProjectId, 15 | name :: !ProjectName 16 | } 17 | deriving stock (Generic, Show, Eq) 18 | deriving anyclass (ToRow, FromRow) 19 | -------------------------------------------------------------------------------- /codebase2/codebase-sqlite/U/Codebase/Sqlite/ProjectBranch.hs: -------------------------------------------------------------------------------- 1 | module U.Codebase.Sqlite.ProjectBranch 2 | ( ProjectBranch (..), 3 | ) 4 | where 5 | 6 | import U.Codebase.Sqlite.DbId (ProjectBranchId, ProjectId) 7 | import Unison.Core.Orphans.Sqlite () 8 | import Unison.Core.Project (ProjectBranchName) 9 | import Unison.Prelude 10 | import Unison.Sqlite (FromRow, ToRow) 11 | 12 | -- | A project branch. 13 | data ProjectBranch = ProjectBranch 14 | { projectId :: !ProjectId, 15 | branchId :: !ProjectBranchId, 16 | name :: !ProjectBranchName, 17 | parentBranchId :: !(Maybe ProjectBranchId) 18 | } 19 | deriving stock (Eq, Generic, Show) 20 | deriving anyclass (ToRow, FromRow) 21 | -------------------------------------------------------------------------------- /codebase2/codebase-sqlite/U/Codebase/Sqlite/RemoteProject.hs: -------------------------------------------------------------------------------- 1 | module U.Codebase.Sqlite.RemoteProject 2 | ( RemoteProject (..), 3 | ) 4 | where 5 | 6 | import Network.URI (URI) 7 | import Network.URI.Orphans.Sqlite () 8 | import U.Codebase.Sqlite.DbId (RemoteProjectId) 9 | import Unison.Core.Orphans.Sqlite () 10 | import Unison.Core.Project (ProjectName) 11 | import Unison.Prelude 12 | import Unison.Sqlite (FromRow, ToRow) 13 | 14 | -- | A remote project. 15 | data RemoteProject = RemoteProject 16 | { projectId :: RemoteProjectId, 17 | host :: URI, 18 | name :: ProjectName 19 | } 20 | deriving stock (Generic, Show) 21 | deriving anyclass (ToRow, FromRow) 22 | -------------------------------------------------------------------------------- /codebase2/codebase-sqlite/U/Codebase/Sqlite/RemoteProjectBranch.hs: -------------------------------------------------------------------------------- 1 | module U.Codebase.Sqlite.RemoteProjectBranch 2 | ( RemoteProjectBranch (..), 3 | ) 4 | where 5 | 6 | import Network.URI (URI) 7 | import Network.URI.Orphans.Sqlite () 8 | import U.Codebase.Sqlite.DbId (RemoteProjectBranchId, RemoteProjectId) 9 | import Unison.Core.Orphans.Sqlite () 10 | import Unison.Core.Project (ProjectBranchName) 11 | import Unison.Prelude 12 | import Unison.Sqlite (FromRow, ToRow) 13 | 14 | data RemoteProjectBranch = RemoteProjectBranch 15 | { projectId :: RemoteProjectId, 16 | branchId :: RemoteProjectBranchId, 17 | host :: URI, 18 | name :: ProjectBranchName 19 | } 20 | deriving stock (Generic, Show) 21 | deriving anyclass (ToRow, FromRow) 22 | -------------------------------------------------------------------------------- /codebase2/codebase-sqlite/U/Codebase/Sqlite/Symbol.hs: -------------------------------------------------------------------------------- 1 | module U.Codebase.Sqlite.Symbol where 2 | 3 | import Data.Set qualified as Set 4 | import Data.Text (Text) 5 | import Data.Word (Word64) 6 | import U.Core.ABT.Var qualified as ABT 7 | 8 | data Symbol = Symbol !Word64 !Text deriving (Eq, Ord, Show) 9 | 10 | -- | This clever instance relies on Ord to synthesize a new id. 11 | -- If i > i2, then s > vs; otherwise increment the max i2: 12 | -- freshIn [(0,"foo"), (1,"bar")] (0,"cat") = (3, "cat") 13 | instance ABT.Var Symbol where 14 | freshIn vs s | Set.null vs || Set.notMember s vs = s -- already fresh! 15 | freshIn vs s@(Symbol i n) = case Set.elemAt (Set.size vs - 1) vs of 16 | Symbol i2 _ -> if i > i2 then s else Symbol (i2 + 1) n 17 | -------------------------------------------------------------------------------- /codebase2/codebase-sqlite/sql/002-reflog-table.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE reflog ( 2 | -- Reminder that SQLITE doesn't have any actual 'time' type, 3 | -- This column contains TEXT values formatted as ISO8601 strings 4 | -- ("YYYY-MM-DD HH:MM:SS.SSS") 5 | time TEXT NOT NULL, 6 | from_root_causal_id INTEGER NOT NULL REFERENCES causal(self_hash_id), 7 | to_root_causal_id INTEGER NOT NULL REFERENCES causal(self_hash_id), 8 | reason TEXT NOT NULL 9 | ); 10 | 11 | CREATE INDEX reflog_time_desc ON reflog ( 12 | time DESC 13 | ); 14 | -------------------------------------------------------------------------------- /codebase2/codebase-sqlite/sql/006-most-recent-branch-table.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE most_recent_branch ( 2 | project_id uuid PRIMARY KEY REFERENCES project (id) ON DELETE CASCADE, 3 | branch_id uuid NOT NULL, 4 | FOREIGN KEY (project_id, branch_id) REFERENCES project_branch (project_id, branch_id) ON DELETE CASCADE) WITHOUT rowid; 5 | -------------------------------------------------------------------------------- /codebase2/codebase-sqlite/sql/008-add-most-recent-namespace-table.sql: -------------------------------------------------------------------------------- 1 | -- The most recent namespace that a user cd'd to. 2 | -- This table should never have more than one row. 3 | CREATE TABLE "most_recent_namespace" ( 4 | -- A json array like ["foo", "bar"]; the root namespace is represented by the empty array 5 | "namespace" TEXT PRIMARY KEY NOT NULL 6 | ) WITHOUT ROWID; 7 | 8 | INSERT INTO "most_recent_namespace" ("namespace") VALUES ('[]'); 9 | -------------------------------------------------------------------------------- /codebase2/codebase-sqlite/sql/009-add-squash-cache-table.sql: -------------------------------------------------------------------------------- 1 | -- A table for tracking the results of squashes we've performed. 2 | -- This is used to avoid re-squashing the same branch multiple times. 3 | CREATE TABLE "squash_results" ( 4 | -- The branch hash of the namespace to be squashed. 5 | -- There should only ever be one result for each unsquashed value hash. 6 | branch_hash_id INTEGER PRIMARY KEY NOT NULL REFERENCES hash(id), 7 | 8 | -- The causal hash id which is the result of squashing the 'branch_hash_id's causal.' 9 | squashed_causal_hash_id INTEGER NOT NULL REFERENCES causal(self_hash_id) 10 | ) WITHOUT ROWID; 11 | -------------------------------------------------------------------------------- /codebase2/codebase-sqlite/sql/011-cd-to-project-root.sql: -------------------------------------------------------------------------------- 1 | -- As part of deprecating cd, we want users who have cd'd deeper than their project root to be parked at the root instead. 2 | UPDATE "most_recent_namespace" 3 | SET "namespace" = json_array("namespace" -> 0, "namespace" -> 1, "namespace" -> 2, "namespace" -> 3) 4 | WHERE "namespace" ->> 0 = '__projects' 5 | AND json_array_length("namespace") > 4; 6 | -------------------------------------------------------------------------------- /codebase2/codebase-sqlite/sql/012-add-current-project-path-table.sql: -------------------------------------------------------------------------------- 1 | -- The most recent namespace that a user cd'd to. 2 | -- This table should never have more than one row. 3 | CREATE TABLE current_project_path ( 4 | project_id INTEGER NOT NULL, 5 | branch_id INTEGER NOT NULL, 6 | -- A json array like ["foo", "bar"]; the root namespace is represented by the empty array 7 | path TEXT PRIMARY KEY NOT NULL, 8 | 9 | foreign key (project_id, branch_id) 10 | references project_branch (project_id, branch_id) 11 | -- Prevent deleting the project you're currently in. 12 | on delete no action 13 | ) WITHOUT ROWID; 14 | 15 | DROP TABLE most_recent_namespace; 16 | -------------------------------------------------------------------------------- /codebase2/codebase-sqlite/sql/014-add-project-branch-causal-hash-id.sql: -------------------------------------------------------------------------------- 1 | -- Add a new column to the project_branch table to store the causal_hash_id 2 | ALTER TABLE project_branch ADD COLUMN causal_hash_id INTEGER NOT NULL; 3 | -------------------------------------------------------------------------------- /codebase2/codebase-sqlite/sql/015-add-project-branch-last-accessed.sql: -------------------------------------------------------------------------------- 1 | -- Add a new column to the project_branch table to store the last time that project branch was accessed. 2 | -- This column is stored as a unix epoch time. 3 | ALTER TABLE project_branch ADD COLUMN last_accessed INTEGER NULL; 4 | -------------------------------------------------------------------------------- /codebase2/codebase-sync/package.yaml: -------------------------------------------------------------------------------- 1 | name: unison-codebase-sync 2 | github: unisonweb/unison 3 | 4 | library: 5 | source-dirs: . 6 | when: 7 | - condition: false 8 | other-modules: Paths_unison_codebase_sync 9 | 10 | dependencies: 11 | - base 12 | -------------------------------------------------------------------------------- /codebase2/codebase-sync/unison-codebase-sync.cabal: -------------------------------------------------------------------------------- 1 | cabal-version: 1.12 2 | 3 | -- This file has been generated from package.yaml by hpack version 0.35.0. 4 | -- 5 | -- see: https://github.com/sol/hpack 6 | 7 | name: unison-codebase-sync 8 | version: 0.0.0 9 | homepage: https://github.com/unisonweb/unison#readme 10 | bug-reports: https://github.com/unisonweb/unison/issues 11 | build-type: Simple 12 | 13 | source-repository head 14 | type: git 15 | location: https://github.com/unisonweb/unison 16 | 17 | library 18 | exposed-modules: 19 | U.Codebase.Sync 20 | hs-source-dirs: 21 | ./ 22 | build-depends: 23 | base 24 | default-language: Haskell2010 25 | -------------------------------------------------------------------------------- /codebase2/codebase/U/Codebase/Kind.hs: -------------------------------------------------------------------------------- 1 | module U.Codebase.Kind where 2 | 3 | data Kind = Star | Arrow Kind Kind deriving (Eq, Ord, Read, Show) 4 | -------------------------------------------------------------------------------- /codebase2/codebase/U/Codebase/Reflog.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE ViewPatterns #-} 2 | 3 | module U.Codebase.Reflog where 4 | 5 | import Data.Bifoldable 6 | import Data.Bifunctor 7 | import Data.Bitraversable 8 | import Data.Time (UTCTime) 9 | 10 | data Entry causal text = Entry 11 | { time :: UTCTime, 12 | fromRootCausalHash :: causal, 13 | toRootCausalHash :: causal, 14 | reason :: text 15 | } 16 | deriving (Functor) 17 | 18 | instance Bifunctor Entry where 19 | bimap = bimapDefault 20 | 21 | instance Bifoldable Entry where 22 | bifoldMap = bifoldMapDefault 23 | 24 | instance Bitraversable Entry where 25 | bitraverse f g (Entry time fch tch reason) = 26 | Entry time <$> f fch <*> f tch <*> g reason 27 | -------------------------------------------------------------------------------- /codebase2/codebase/U/Codebase/TermEdit.hs: -------------------------------------------------------------------------------- 1 | module U.Codebase.TermEdit where 2 | 3 | import U.Codebase.Referent (Referent) 4 | 5 | data TermEdit = Replace Referent Typing | Deprecate 6 | deriving (Eq, Ord, Show) 7 | 8 | -- Replacements with the Same type can be automatically propagated. 9 | -- Replacements with a Subtype can be automatically propagated but may result in dependents getting more general types, so requires re-inference. 10 | -- Replacements of a Different type need to be manually propagated by the programmer. 11 | data Typing = Same | Subtype | Different 12 | deriving (Eq, Ord, Show) 13 | -------------------------------------------------------------------------------- /codebase2/codebase/U/Codebase/TypeEdit.hs: -------------------------------------------------------------------------------- 1 | module U.Codebase.TypeEdit where 2 | 3 | import U.Codebase.Reference (Reference) 4 | 5 | data TypeEdit = Replace Reference | Deprecate 6 | deriving (Eq, Ord, Show) 7 | -------------------------------------------------------------------------------- /codebase2/codebase/U/Codebase/WatchKind.hs: -------------------------------------------------------------------------------- 1 | module U.Codebase.WatchKind where 2 | 3 | data WatchKind = RegularWatch | TestWatch deriving (Eq, Ord, Show) 4 | -------------------------------------------------------------------------------- /codebase2/core/U/Core/ABT/Var.hs: -------------------------------------------------------------------------------- 1 | module U.Core.ABT.Var where 2 | 3 | import Data.Set (Set) 4 | 5 | -- | A class for avoiding accidental variable capture 6 | -- 7 | -- * `Set.notMember (freshIn vs v) vs`: 8 | -- `freshIn` returns a variable not used in the `Set` 9 | class (Ord v) => Var v where 10 | freshIn :: Set v -> v -> v 11 | -------------------------------------------------------------------------------- /codebase2/util-serialization/package.yaml: -------------------------------------------------------------------------------- 1 | name: unison-util-serialization 2 | 3 | library: 4 | source-dirs: . 5 | when: 6 | - condition: false 7 | other-modules: Paths_unison_util_serialization 8 | 9 | dependencies: 10 | - base 11 | - bytes 12 | - bytestring 13 | - containers 14 | - filepath 15 | - text 16 | - text-short 17 | - unliftio 18 | - vector 19 | -------------------------------------------------------------------------------- /codebase2/util-serialization/unison-util-serialization.cabal: -------------------------------------------------------------------------------- 1 | cabal-version: 1.12 2 | 3 | -- This file has been generated from package.yaml by hpack version 0.35.0. 4 | -- 5 | -- see: https://github.com/sol/hpack 6 | 7 | name: unison-util-serialization 8 | version: 0.0.0 9 | build-type: Simple 10 | 11 | library 12 | exposed-modules: 13 | U.Util.Serialization 14 | hs-source-dirs: 15 | ./ 16 | build-depends: 17 | base 18 | , bytes 19 | , bytestring 20 | , containers 21 | , filepath 22 | , text 23 | , text-short 24 | , unliftio 25 | , vector 26 | default-language: Haskell2010 27 | -------------------------------------------------------------------------------- /codebase2/util-term/package.yaml: -------------------------------------------------------------------------------- 1 | name: unison-util-term 2 | github: unisonweb/unison 3 | 4 | library: 5 | source-dirs: . 6 | when: 7 | - condition: false 8 | other-modules: Paths_unison_util_term 9 | 10 | dependencies: 11 | - base 12 | - containers 13 | - mtl 14 | - unison-core 15 | - unison-codebase 16 | -------------------------------------------------------------------------------- /config: -------------------------------------------------------------------------------- 1 | # Unison configuration file, used for dynamic settings 2 | # This file is just defaults and should not generally be modified. 3 | # Modify the file $(HOME)/.unisonconfig if you wish to override any 4 | # defaults for local development. 5 | 6 | # Can be 0 (off), 1 (error), 2 (warn), 3 (info), 4 (debug), 5 (trace) 7 | logging = 2 8 | -------------------------------------------------------------------------------- /dest.usync: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unisonweb/unison/07a855e4674837f6506957055fc58d901e922715/dest.usync -------------------------------------------------------------------------------- /dev-ui-install.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | set -eu 3 | 4 | echo "This script downloads the latest Unison Local UI release" 5 | echo "and puts it in the correct spot next to the unison" 6 | echo "executable built by stack." 7 | echo "" 8 | 9 | stack build 10 | curl -L https://github.com/unisonweb/unison-local-ui/releases/download/latest/unisonLocal.zip --output unisonLocal.zip 11 | parent_dir="$(dirname -- $(stack exec which unison))" 12 | mkdir -p "$parent_dir/ui" 13 | unzip -q -o unisonLocal.zip -d "$parent_dir/ui" 14 | -------------------------------------------------------------------------------- /docs/publishing.md: -------------------------------------------------------------------------------- 1 | # Publishing Unison code 2 | 3 | Thinking about a design for publishing Unison code revealed a nest of interrelated concerns: 4 | 5 | * [Using library code in my application & sharing my application as a library](publishing-library1.md) 6 | * [Updating my library & sharing an updated library](publishing-library2.md) 7 | 8 | 9 | Each of these linked subtopics presents concerns, questions, and ideas, which we can weigh and collect into [our M1 proposal](publishing-M1.md). 10 | 11 | -------------------------------------------------------------------------------- /editor-support/atom/language-unison/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "language-unison", 3 | "version": "0.0.0", 4 | "description": "An example language grammar package", 5 | "repository": "https://github.com/user/package-name", 6 | "keywords": [ 7 | "syntax", 8 | "highlighting", 9 | "grammar" 10 | ], 11 | "license": "MIT", 12 | "bugs": "https://github.com/user/package-name/issues", 13 | "engines": { 14 | "atom": ">=1.0.0 <2.0.0" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /editor-support/atom/language-unison/settings/settings.cson: -------------------------------------------------------------------------------- 1 | '.source.unison': 2 | 'editor': 3 | commentStart: '--' 4 | -------------------------------------------------------------------------------- /editor-support/vim/ftdetect/unison.vim: -------------------------------------------------------------------------------- 1 | " $URL: https://lampsvn.epfl.ch/svn-repos/scala/scala-tool-support/trunk/src/vim/ftdetect/scala.vim $ 2 | 3 | au BufRead,BufNewFile *.u set filetype=unison 4 | au BufRead,BufNewFile *.uu set filetype=unison 5 | -------------------------------------------------------------------------------- /editor-support/vim/ftplugin/unison.vim: -------------------------------------------------------------------------------- 1 | " Only do this when not done yet for this buffer 2 | if exists("b:did_ftplugin") 3 | finish 4 | endif 5 | let b:did_ftplugin = 1 6 | 7 | setlocal commentstring=--\ %s 8 | setlocal iskeyword+=!,' 9 | " setlocal tabstop=2 10 | " setlocal softtabstop=2 11 | " setlocal shiftwidth=2 12 | " setlocal completefunc=syntaxcomplete#Complete 13 | -------------------------------------------------------------------------------- /lib/orphans/README.md: -------------------------------------------------------------------------------- 1 | Canonical orphans packages. 2 | 3 | The package name template is 4 | 5 | ``` 6 | -orphans- 7 | ``` 8 | 9 | (with some flexibility as to what exactly `` is called; for example, although we are 10 | currently using the `sqlite-simple` package, we call suffix sqlite orphan packages with `-sqlite`, not `-sqlite-simple`, 11 | for no great reason other than aesthetics). 12 | 13 | For example, the package that defines `To/FromField` instances (from `sqlite-simple`) for types defined in `unison-core` 14 | is called `unison-core-orphans-sqlite`. 15 | -------------------------------------------------------------------------------- /lib/orphans/network-uri-orphans-sqlite/src/Network/URI/Orphans/Sqlite.hs: -------------------------------------------------------------------------------- 1 | {-# OPTIONS_GHC -fno-warn-orphans #-} 2 | 3 | module Network.URI.Orphans.Sqlite () where 4 | 5 | import Database.SQLite.Simple.FromField qualified as Sqlite 6 | import Database.SQLite.Simple.ToField qualified as Sqlite 7 | import Network.URI (URI) 8 | import Network.URI qualified as URI 9 | 10 | instance Sqlite.FromField URI where 11 | fromField field = do 12 | string <- Sqlite.fromField field 13 | case URI.parseURI string of 14 | Nothing -> Sqlite.returnError Sqlite.ConversionFailed field "invalid URI" 15 | Just uri -> pure uri 16 | 17 | instance Sqlite.ToField URI where 18 | toField uri = Sqlite.toField (URI.uriToString id uri "") 19 | -------------------------------------------------------------------------------- /lib/orphans/unison-core-orphans-sqlite/src/Unison/Core/Orphans/Sqlite.hs: -------------------------------------------------------------------------------- 1 | {-# OPTIONS_GHC -fno-warn-orphans #-} 2 | 3 | module Unison.Core.Orphans.Sqlite () where 4 | 5 | import Data.Text (Text) 6 | import Database.SQLite.Simple.FromField (FromField) 7 | import Database.SQLite.Simple.ToField (ToField) 8 | import Unison.Core.Project (ProjectBranchName (..), ProjectName (..)) 9 | 10 | deriving via Text instance ToField ProjectName 11 | 12 | deriving via Text instance FromField ProjectName 13 | 14 | deriving via Text instance ToField ProjectBranchName 15 | 16 | deriving via Text instance FromField ProjectBranchName 17 | -------------------------------------------------------------------------------- /lib/orphans/unison-hash-orphans-aeson/src/Unison/Hash32/Orphans/Aeson.hs: -------------------------------------------------------------------------------- 1 | {-# OPTIONS_GHC -fno-warn-orphans #-} 2 | 3 | module Unison.Hash32.Orphans.Aeson () where 4 | 5 | import Data.Aeson (FromJSON, FromJSONKey, ToJSON, ToJSONKey) 6 | import Data.Text (Text) 7 | import U.Util.Base32Hex (Base32Hex (..)) 8 | import Unison.Hash32 (Hash32 (..)) 9 | 10 | deriving via Text instance FromJSON Hash32 11 | 12 | deriving via Text instance FromJSONKey Hash32 13 | 14 | deriving via Text instance ToJSON Hash32 15 | 16 | deriving via Text instance ToJSONKey Hash32 17 | -------------------------------------------------------------------------------- /lib/orphans/unison-hash-orphans-sqlite/src/Unison/Hash32/Orphans/Sqlite.hs: -------------------------------------------------------------------------------- 1 | {-# OPTIONS_GHC -fno-warn-orphans #-} 2 | 3 | module Unison.Hash32.Orphans.Sqlite () where 4 | 5 | import Data.Text (Text) 6 | import Database.SQLite.Simple.FromField (FromField) 7 | import Database.SQLite.Simple.ToField (ToField) 8 | import U.Util.Base32Hex (Base32Hex (..)) 9 | import Unison.Hash32 (Hash32 (..)) 10 | 11 | deriving via Text instance ToField Hash32 12 | 13 | deriving via Text instance FromField Hash32 14 | -------------------------------------------------------------------------------- /lib/orphans/uuid-orphans-sqlite/src/Data/UUID/Orphans/Sqlite.hs: -------------------------------------------------------------------------------- 1 | {-# OPTIONS_GHC -fno-warn-orphans #-} 2 | 3 | module Data.UUID.Orphans.Sqlite () where 4 | 5 | import Data.UUID (UUID) 6 | import Data.UUID qualified as UUID 7 | import Database.SQLite.Simple.FromField qualified as Sqlite 8 | import Database.SQLite.Simple.ToField qualified as Sqlite 9 | 10 | instance Sqlite.FromField UUID where 11 | fromField field = do 12 | text <- Sqlite.fromField field 13 | case UUID.fromText text of 14 | Nothing -> Sqlite.returnError Sqlite.ConversionFailed field "invalid UUID" 15 | Just uuid -> pure uuid 16 | 17 | instance Sqlite.ToField UUID where 18 | toField = Sqlite.toField . UUID.toText 19 | -------------------------------------------------------------------------------- /lib/unison-prelude/src/Unison/Util/Alternative.hs: -------------------------------------------------------------------------------- 1 | module Unison.Util.Alternative 2 | ( whenM, 3 | ) 4 | where 5 | 6 | import Control.Applicative (Alternative (empty)) 7 | 8 | whenM :: (Monad m, Alternative m) => m Bool -> a -> m a 9 | whenM m a = do 10 | b <- m 11 | if b then pure a else empty 12 | -------------------------------------------------------------------------------- /lib/unison-prelude/src/Unison/Util/Lens.hs: -------------------------------------------------------------------------------- 1 | module Unison.Util.Lens 2 | ( Field1', 3 | Field2', 4 | Field3', 5 | Field4', 6 | ) 7 | where 8 | 9 | import Control.Lens qualified as Lens 10 | 11 | type Field1' s a = Lens.Field1 s s a a 12 | 13 | type Field2' s a = Lens.Field2 s s a a 14 | 15 | type Field3' s a = Lens.Field3 s s a a 16 | 17 | type Field4' s a = Lens.Field4 s s a a 18 | -------------------------------------------------------------------------------- /lib/unison-prelude/src/Unison/Util/Tuple.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE FunctionalDependencies #-} 2 | {-# LANGUAGE TypeOperators #-} 3 | {-# LANGUAGE UndecidableInstances #-} 4 | 5 | -- | Tuple utils. 6 | module Unison.Util.Tuple 7 | ( drop4th, 8 | ) 9 | where 10 | 11 | class Drop4th a b | a -> b where 12 | -- | Drop the 4th element of a tuple. 13 | drop4th :: a -> b 14 | 15 | instance (x ~ (a, b, c)) => Drop4th (a, b, c, d) x where 16 | drop4th (a, b, c, _) = (a, b, c) 17 | -------------------------------------------------------------------------------- /lib/unison-sqlite/README.md: -------------------------------------------------------------------------------- 1 | # unison-sqlite 2 | 3 | This package provides a interface to SQLite for Unison packages. 4 | 5 | To print all queries and their responses to stderr, set `UNISON_DEBUG=sqlite` (or just `UNISON_DEBUG=`). 6 | -------------------------------------------------------------------------------- /lib/unison-sqlite/src/Unison/Sqlite/Connection/Internal.hs: -------------------------------------------------------------------------------- 1 | module Unison.Sqlite.Connection.Internal 2 | ( Connection (..), 3 | ) 4 | where 5 | 6 | import Data.Map (Map) 7 | import Data.Text (Text) 8 | import Database.SQLite.Simple qualified as Sqlite 9 | import UnliftIO.STM (TVar) 10 | 11 | -- | A /non-thread safe/ connection to a SQLite database. 12 | data Connection = Connection 13 | { name :: String, 14 | file :: FilePath, 15 | conn :: Sqlite.Connection, 16 | statementCache :: TVar (Map Text Sqlite.Statement) 17 | } 18 | 19 | instance Show Connection where 20 | show (Connection name file _conn _statementCache) = 21 | "Connection { name = " ++ show name ++ ", file = " ++ show file ++ " }" 22 | -------------------------------------------------------------------------------- /lib/unison-sqlite/src/Unison/Sqlite/DataVersion.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE QuasiQuotes #-} 2 | 3 | module Unison.Sqlite.DataVersion 4 | ( DataVersion (..), 5 | getDataVersion, 6 | ) 7 | where 8 | 9 | import Unison.Prelude 10 | import Unison.Sqlite.Sql (sql) 11 | import Unison.Sqlite.Transaction 12 | 13 | newtype DataVersion 14 | = DataVersion Int64 15 | deriving stock (Eq) 16 | deriving newtype (Show) 17 | 18 | getDataVersion :: Transaction DataVersion 19 | getDataVersion = 20 | coerce @(Transaction Int64) (queryOneCol [sql| PRAGMA data_version |]) 21 | -------------------------------------------------------------------------------- /lib/unison-sqlite/src/Unison/Sqlite/Internal.hs: -------------------------------------------------------------------------------- 1 | -- | Internals exported for testing. 2 | module Unison.Sqlite.Internal (module X) where 3 | 4 | import Unison.Sqlite.Sql as X (Param (..), ParsedLump (..), internalParseSql) 5 | -------------------------------------------------------------------------------- /lib/unison-util-file-embed/src/Unison/Util/FileEmbed.hs: -------------------------------------------------------------------------------- 1 | module Unison.Util.FileEmbed (embedProjectStringFile) where 2 | 3 | import Data.FileEmbed (embedStringFile, makeRelativeToProject) 4 | import Language.Haskell.TH.Syntax (Exp, Q) 5 | 6 | embedProjectStringFile :: FilePath -> Q Exp 7 | embedProjectStringFile fp = makeRelativeToProject fp >>= embedStringFile 8 | -------------------------------------------------------------------------------- /nix/dependencies.nix: -------------------------------------------------------------------------------- 1 | {nixpkgs-release}: final: prev: let 2 | pinned-pkgs = import nixpkgs-release {inherit (final) system;}; 3 | in { 4 | stack = pinned-pkgs.stack; 5 | 6 | ## See https://docs.haskellstack.org/en/stable/nix_integration/#supporting-both-nix-and-non-nix-developers for an 7 | ## explanation of this package. 8 | stack-wrapped = final.symlinkJoin { 9 | name = "stack"; # will be available as the usual `stack` in terminal 10 | paths = [final.stack]; 11 | buildInputs = [final.makeWrapper]; 12 | postBuild = '' 13 | wrapProgram $out/bin/stack \ 14 | --add-flags "\ 15 | --no-nix \ 16 | --system-ghc \ 17 | --no-install-ghc \ 18 | " 19 | ''; 20 | }; 21 | } 22 | -------------------------------------------------------------------------------- /nix/docker.nix: -------------------------------------------------------------------------------- 1 | { 2 | pkgs, 3 | haskell-nix, 4 | }: { 5 | ucm = pkgs.dockerTools.buildLayeredImage { 6 | name = "ucm"; 7 | tag = "latest"; 8 | contents = with pkgs; [cacert fzf]; 9 | config.Cmd = ["${haskell-nix."unison-cli-main:exe:unison"}/bin/unison"]; 10 | }; 11 | } 12 | -------------------------------------------------------------------------------- /nix/versions.nix: -------------------------------------------------------------------------------- 1 | {lib ? (import {}).lib}: let 2 | ## It’s much easier to read from a JSON file than to have JSON import from some other file, so we extract some 3 | ## configuration from the VS Code settings to avoid duplication. 4 | vscodeSettings = lib.importJSON ../.vscode/settings.json; 5 | in 6 | vscodeSettings."haskell.toolchain" 7 | ## There are some things we want to pin that the VS Code Haskell extension doesn’t let us control. 8 | // { 9 | hpack = "0.35.2"; 10 | ormolu = "0.7.2.0"; 11 | } 12 | -------------------------------------------------------------------------------- /parser-typechecker/src/Unison/Codebase/Branch/Raw.hs: -------------------------------------------------------------------------------- 1 | module Unison.Codebase.Branch.Raw where 2 | 3 | import Data.Map (Map) 4 | import Unison.Codebase.Metadata qualified as Metadata 5 | import Unison.Hash (Hash) 6 | import Unison.Hash qualified as Hash 7 | import Unison.NameSegment (NameSegment) 8 | import Unison.Reference (Reference) 9 | import Unison.Referent (Referent) 10 | 11 | type Star r n = Metadata.Star r n 12 | 13 | type EditHash = Hash.Hash 14 | 15 | -- The raw Branch 16 | data Raw = Raw 17 | { _termsR :: Star Referent NameSegment, 18 | _typesR :: Star Reference NameSegment, 19 | _childrenR :: Map NameSegment Hash, 20 | _editsR :: Map NameSegment EditHash 21 | } 22 | -------------------------------------------------------------------------------- /parser-typechecker/src/Unison/Codebase/BuiltinAnnotation.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE OverloadedStrings #-} 2 | {-# LANGUAGE ViewPatterns #-} 3 | 4 | module Unison.Codebase.BuiltinAnnotation (BuiltinAnnotation (..)) where 5 | 6 | import Unison.Parser.Ann (Ann) 7 | import Unison.Parser.Ann qualified as Ann 8 | 9 | class BuiltinAnnotation a where 10 | builtinAnnotation :: a 11 | 12 | instance BuiltinAnnotation Ann where 13 | builtinAnnotation = Ann.Intrinsic 14 | 15 | instance BuiltinAnnotation () where 16 | builtinAnnotation = () 17 | -------------------------------------------------------------------------------- /parser-typechecker/src/Unison/Codebase/Init/CreateCodebaseError.hs: -------------------------------------------------------------------------------- 1 | module Unison.Codebase.Init.CreateCodebaseError 2 | ( CreateCodebaseError (..), 3 | Pretty, 4 | ) 5 | where 6 | 7 | import Unison.Util.Pretty qualified as P 8 | 9 | type Pretty = P.Pretty P.ColorText 10 | 11 | data CreateCodebaseError 12 | = CreateCodebaseAlreadyExists 13 | deriving stock (Show) 14 | -------------------------------------------------------------------------------- /parser-typechecker/src/Unison/Codebase/Patch.hs: -------------------------------------------------------------------------------- 1 | module Unison.Codebase.Patch (Patch (..)) where 2 | 3 | import Unison.Codebase.TermEdit (TermEdit) 4 | import Unison.Codebase.TypeEdit (TypeEdit) 5 | import Unison.Reference (Reference) 6 | import Unison.Util.Relation (Relation) 7 | import Prelude hiding (head, read, subtract) 8 | 9 | data Patch = Patch 10 | { _termEdits :: Relation Reference TermEdit, 11 | _typeEdits :: Relation Reference TypeEdit 12 | } 13 | deriving (Eq, Ord, Show) 14 | -------------------------------------------------------------------------------- /parser-typechecker/src/Unison/Codebase/PushBehavior.hs: -------------------------------------------------------------------------------- 1 | -- | This module defines the 'PushBehavior' type. 2 | module Unison.Codebase.PushBehavior 3 | ( PushBehavior (..), 4 | ) 5 | where 6 | 7 | -- | How a `push` behaves. 8 | data PushBehavior 9 | = -- Force-push over what's there. 10 | ForcePush 11 | | -- | The namespace being pushed to is required to be empty. 12 | RequireEmpty 13 | | -- | The namespace being pushed to is required to be non-empty 14 | RequireNonEmpty 15 | deriving stock (Eq, Show) 16 | -------------------------------------------------------------------------------- /parser-typechecker/src/Unison/Codebase/SqliteCodebase/Migrations/Helpers.hs: -------------------------------------------------------------------------------- 1 | module Unison.Codebase.SqliteCodebase.Migrations.Helpers where 2 | 3 | import Unison.Sqlite qualified as Sqlite 4 | 5 | abortMigration :: String -> Sqlite.Transaction a 6 | abortMigration msg = do 7 | error $ 8 | unlines 9 | [ "⚠️ " <> msg, 10 | "", 11 | "An unrecoverable error occurred, the migration has been aborted.", 12 | "Please report this bug to https://github.com/unisonweb/unison/issues and include your migration output.", 13 | "Downgrading to the previous UCM version will allow you to continue using your codebase while we investigate your issue." 14 | ] 15 | -------------------------------------------------------------------------------- /parser-typechecker/src/Unison/Codebase/SqliteCodebase/SyncEphemeral.hs: -------------------------------------------------------------------------------- 1 | module Unison.Codebase.SqliteCodebase.SyncEphemeral where 2 | 3 | import U.Codebase.HashTags (CausalHash) 4 | import U.Codebase.Sqlite.DbId (SchemaVersion) 5 | import Unison.Hash (Hash) 6 | import Unison.Prelude 7 | 8 | data Dependencies = Dependencies 9 | { definitions :: Set Hash, 10 | branches :: Set Hash 11 | } 12 | 13 | data Error 14 | = SrcWrongSchema SchemaVersion 15 | | DestWrongSchema SchemaVersion 16 | | DisappearingBranch CausalHash 17 | deriving stock (Show) 18 | deriving anyclass (Exception) 19 | -------------------------------------------------------------------------------- /parser-typechecker/src/Unison/Codebase/TermEdit/Typing.hs: -------------------------------------------------------------------------------- 1 | module Unison.Codebase.TermEdit.Typing where 2 | 3 | import Unison.Codebase.TermEdit (Typing (Different, Same, Subtype)) 4 | import Unison.Type (Type) 5 | import Unison.Typechecker qualified as Typechecker 6 | import Unison.Var (Var) 7 | 8 | typing :: (Var v) => Type v loc -> Type v loc -> Typing 9 | typing newType oldType 10 | | Typechecker.isEqual newType oldType = Same 11 | | Typechecker.isSubtype newType oldType = Subtype 12 | | otherwise = Different 13 | -------------------------------------------------------------------------------- /parser-typechecker/src/Unison/Codebase/TypeEdit.hs: -------------------------------------------------------------------------------- 1 | module Unison.Codebase.TypeEdit where 2 | 3 | import Unison.Reference (Reference) 4 | 5 | data TypeEdit = Replace Reference | Deprecate 6 | deriving (Eq, Ord, Show) 7 | 8 | references :: TypeEdit -> [Reference] 9 | references (Replace r) = [r] 10 | references Deprecate = [] 11 | 12 | toReference :: TypeEdit -> Maybe Reference 13 | toReference (Replace r) = Just r 14 | toReference Deprecate = Nothing 15 | -------------------------------------------------------------------------------- /parser-typechecker/src/Unison/Codebase/Verbosity.hs: -------------------------------------------------------------------------------- 1 | module Unison.Codebase.Verbosity where 2 | 3 | data Verbosity = Verbose | Silent deriving (Eq, Show) 4 | 5 | isSilent :: Verbosity -> Bool 6 | isSilent v = case v of 7 | Verbose -> False 8 | Silent -> True 9 | -------------------------------------------------------------------------------- /parser-typechecker/src/Unison/CodebasePath.hs: -------------------------------------------------------------------------------- 1 | module Unison.CodebasePath 2 | ( CodebasePath, 3 | getCodebaseDir, 4 | ) 5 | where 6 | 7 | import Control.Monad.IO.Class (MonadIO) 8 | import UnliftIO.Directory (getHomeDirectory) 9 | 10 | -- | A directory that contains a codebase. 11 | type CodebasePath = FilePath 12 | 13 | getCodebaseDir :: (MonadIO m) => Maybe CodebasePath -> m CodebasePath 14 | getCodebaseDir = maybe getHomeDirectory pure 15 | -------------------------------------------------------------------------------- /parser-typechecker/src/Unison/KindInference/Constraint/Context.hs: -------------------------------------------------------------------------------- 1 | module Unison.KindInference.Constraint.Context 2 | ( ConstraintContext (..), 3 | ) 4 | where 5 | 6 | import Unison.KindInference.UVar (UVar) 7 | import Unison.Type (Type) 8 | 9 | -- | The context in which the constraint was generated. This is useful 10 | -- when generating user-facing error messages. 11 | data ConstraintContext v loc 12 | = AppAbs !(UVar v loc) !(UVar v loc) 13 | | AppArg !(UVar v loc) !(UVar v loc) !(UVar v loc) 14 | | AppArrow loc !(Type v loc) !(Type v loc) 15 | | Annotation 16 | | EffectsList 17 | | ScopeReference 18 | | TypeAnnotation 19 | | DeclDefinition 20 | | Builtin 21 | | ContextLookup 22 | deriving stock (Show, Eq, Ord) 23 | -------------------------------------------------------------------------------- /parser-typechecker/src/Unison/KindInference/UVar.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE DataKinds #-} 2 | 3 | module Unison.KindInference.UVar 4 | ( UVar (..), 5 | ) 6 | where 7 | 8 | import Unison.Symbol 9 | import Unison.Type qualified as T 10 | 11 | data UVar v loc = UVar 12 | { _uvarSymbol :: Symbol, 13 | uvarType :: T.Type v loc 14 | } 15 | deriving stock (Eq, Ord, Show) 16 | -------------------------------------------------------------------------------- /parser-typechecker/src/Unison/PatternMatchCoverage/EffectHandler.hs: -------------------------------------------------------------------------------- 1 | module Unison.PatternMatchCoverage.EffectHandler where 2 | 3 | import Unison.ConstructorReference (ConstructorReference) 4 | import Unison.PatternMatchCoverage.Pretty 5 | import Unison.Prelude 6 | import Unison.PrettyPrintEnv (PrettyPrintEnv) 7 | import Unison.Util.Pretty 8 | 9 | data EffectHandler 10 | = NoEffect 11 | | Effect ConstructorReference 12 | deriving stock (Show, Eq, Ord, Generic) 13 | 14 | prettyEffectHandler :: PrettyPrintEnv -> EffectHandler -> Pretty ColorText 15 | prettyEffectHandler ppe = \case 16 | NoEffect -> "pure" 17 | Effect cr -> prettyConstructorReference ppe cr 18 | -------------------------------------------------------------------------------- /parser-typechecker/src/Unison/PatternMatchCoverage/ListPat.hs: -------------------------------------------------------------------------------- 1 | module Unison.PatternMatchCoverage.ListPat where 2 | 3 | import Unison.Util.Pretty 4 | 5 | data ListPat 6 | = Cons 7 | | Snoc 8 | | Nil 9 | deriving stock (Show, Eq, Ord) 10 | 11 | prettyListPat :: ListPat -> Pretty ColorText 12 | prettyListPat = \case 13 | Cons -> "Cons" 14 | Snoc -> "Snoc" 15 | Nil -> "Nil" 16 | -------------------------------------------------------------------------------- /parser-typechecker/src/Unison/PatternMatchCoverage/PmLit.hs: -------------------------------------------------------------------------------- 1 | module Unison.PatternMatchCoverage.PmLit where 2 | 3 | import Unison.Prelude 4 | import Unison.Util.Pretty (Pretty, string) 5 | 6 | data PmLit 7 | = Int Int64 8 | | Nat Word64 9 | | Boolean Bool 10 | | Float Double 11 | | Text Text 12 | | Char Char 13 | deriving stock (Show, Eq, Ord) 14 | 15 | prettyPmLit :: (IsString s) => PmLit -> Pretty s 16 | prettyPmLit = 17 | string . \case 18 | Int x -> show x 19 | Nat x -> show x 20 | Boolean x -> show x 21 | Float x -> show x 22 | Text x -> show x 23 | Char x -> show x 24 | -------------------------------------------------------------------------------- /parser-typechecker/src/Unison/PrettyPrintEnvDecl/Names.hs: -------------------------------------------------------------------------------- 1 | module Unison.PrettyPrintEnvDecl.Names 2 | ( makePPED, 3 | ) 4 | where 5 | 6 | import Unison.PrettyPrintEnv.Names qualified as PPE 7 | import Unison.PrettyPrintEnvDecl (PrettyPrintEnvDecl (PrettyPrintEnvDecl)) 8 | 9 | makePPED :: PPE.Namer -> PPE.Suffixifier -> PrettyPrintEnvDecl 10 | makePPED namer suffixifier = 11 | PrettyPrintEnvDecl 12 | (PPE.makePPE namer PPE.dontSuffixify) 13 | (PPE.makePPE namer suffixifier) 14 | -------------------------------------------------------------------------------- /scheme-libs/racket/unison/.gitignore: -------------------------------------------------------------------------------- 1 | compiled/ 2 | boot-generated.ss 3 | builtin-generated.ss 4 | compound-wrappers.ss 5 | data-info.ss 6 | simple-wrappers.ss 7 | -------------------------------------------------------------------------------- /scheme-libs/racket/unison/info.rkt: -------------------------------------------------------------------------------- 1 | #lang info 2 | 3 | (define collection "unison") 4 | 5 | (define deps 6 | (list 7 | "x509-lib" 8 | "r6rs-lib" 9 | "rackunit-lib" 10 | "math-lib" 11 | "srfi-lib" 12 | )) 13 | -------------------------------------------------------------------------------- /scripts/check.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | true \ 4 | && stack build --fast --test \ 5 | && stack exec transcripts \ 6 | && stack exec unison transcript unison-src/transcripts-round-trip/main.md \ 7 | && stack exec unison transcript unison-src/transcripts-manual/rewrites.md \ 8 | && stack exec unison transcript unison-src/transcripts-manual/docs.to-html.md \ 9 | && stack exec cli-integration-tests \ 10 | && ./scripts/check-formatting 11 | -------------------------------------------------------------------------------- /scripts/install-hooks.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | GIT_DIR=$(git rev-parse --git-dir) 4 | 5 | echo "Installing hooks..." 6 | # this command creates symlink to our pre-commit script 7 | ln -s ../../scripts/pre-commit.bash $GIT_DIR/hooks/pre-commit 8 | ln -s ../../scripts/pre-push.bash $GIT_DIR/hooks/pre-push 9 | echo "Done!" 10 | -------------------------------------------------------------------------------- /scripts/pre-commit.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | echo "Running pre-commit hook from "`pwd` 4 | ./scripts/test.sh 5 | 6 | # $? stores exit value of the last command 7 | if [ $? -ne 0 ]; then 8 | echo "Tests must pass before commit!" 9 | exit 1 10 | fi 11 | -------------------------------------------------------------------------------- /scripts/pre-push.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Run the following command in the root of your project to install this pre-push hook: 3 | # cp git-hooks/pre-push .git/hooks/pre-push; chmod 700 .git/hooks/pre-push 4 | 5 | # Check if we actually have commits to push 6 | commits=`git log @{u}..` 7 | if [ -z "$commits" ]; then 8 | exit 0 9 | fi 10 | 11 | CMD="./scripts/test.sh" 12 | eval $CMD 13 | RESULT=$? 14 | if [ $RESULT -ne 0 ]; then 15 | echo "The git push operation was canceled because \`$CMD\` did not complete successfully." 16 | exit 1 17 | fi 18 | exit 0 19 | -------------------------------------------------------------------------------- /scripts/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | stack build --fast --test 3 | -------------------------------------------------------------------------------- /scripts/toucher.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | function touch_the_things { 4 | for x in $(seq 10 1) 5 | do 6 | echo $x 7 | sleep 1 8 | done 9 | for i in $(find unison-src/tests -name *.u) 10 | do 11 | touch $i 12 | done 13 | } 14 | 15 | touch_the_things & 16 | stack exec unison 17 | 18 | -------------------------------------------------------------------------------- /scripts/unisonloop.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | until (stack build && \ 4 | stack exec unison) 5 | do 6 | echo "Well that didn't work." 7 | echo Press any key to re-launch. 8 | read -n 1 9 | done 10 | -------------------------------------------------------------------------------- /unison-cli-integration/integration-tests/IntegrationTests/print.u: -------------------------------------------------------------------------------- 1 | print _ = () 2 | -------------------------------------------------------------------------------- /unison-cli-main/unison/Main.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE ApplicativeDo #-} 2 | {-# LANGUAGE NamedFieldPuns #-} 3 | {-# LANGUAGE PartialTypeSignatures #-} 4 | {-# LANGUAGE RankNTypes #-} 5 | {-# LANGUAGE TemplateHaskell #-} 6 | {-# LANGUAGE ViewPatterns #-} 7 | {-# OPTIONS_GHC -Wno-partial-type-signatures #-} 8 | 9 | module Main (main) where 10 | 11 | import Unison.Main qualified 12 | import Version (version) 13 | 14 | main :: IO () 15 | main = Unison.Main.main version 16 | -------------------------------------------------------------------------------- /unison-cli/src/Unison/Codebase/Editor/HandleInput/LSPDebug.hs: -------------------------------------------------------------------------------- 1 | module Unison.Codebase.Editor.HandleInput.LSPDebug (debugLspNameCompletion) where 2 | 3 | import Unison.Cli.Monad (Cli) 4 | import Unison.Cli.Monad qualified as Cli 5 | import Unison.Cli.NamesUtils qualified as Cli 6 | import Unison.Codebase.Editor.Output (Output (DisplayDebugLSPNameCompletions)) 7 | import Unison.LSP.Completion qualified as Completion 8 | import Unison.Prelude 9 | 10 | debugLspNameCompletion :: Text -> Cli () 11 | debugLspNameCompletion prefix = do 12 | names <- Cli.currentNames 13 | let ct = Completion.namesToCompletionTree names 14 | let (_, matches) = Completion.completionsForQuery ct prefix 15 | Cli.respond $ DisplayDebugLSPNameCompletions matches 16 | -------------------------------------------------------------------------------- /unison-cli/src/Unison/Codebase/Editor/HandleInput/Projects.hs: -------------------------------------------------------------------------------- 1 | -- | @projects@ input handler 2 | module Unison.Codebase.Editor.HandleInput.Projects 3 | ( handleProjects, 4 | ) 5 | where 6 | 7 | import U.Codebase.Sqlite.Queries qualified as Queries 8 | import Unison.Cli.Monad (Cli) 9 | import Unison.Cli.Monad qualified as Cli 10 | import Unison.Codebase.Editor.Output qualified as Output 11 | 12 | handleProjects :: Cli () 13 | handleProjects = do 14 | projects <- Cli.runTransaction Queries.loadAllProjects 15 | Cli.respondNumbered (Output.ListProjects projects) 16 | -------------------------------------------------------------------------------- /unison-cli/src/Unison/Codebase/Editor/Output/DumpNamespace.hs: -------------------------------------------------------------------------------- 1 | module Unison.Codebase.Editor.Output.DumpNamespace where 2 | 3 | import U.Codebase.HashTags (CausalHash, PatchHash) 4 | import Unison.NameSegment (NameSegment) 5 | import Unison.Prelude 6 | import Unison.Reference (Reference) 7 | import Unison.Referent (Referent) 8 | 9 | data DumpNamespace = DumpNamespace 10 | { terms :: Map Referent (Set NameSegment), 11 | types :: Map Reference (Set NameSegment), 12 | patches :: Map NameSegment PatchHash, 13 | children :: Map NameSegment CausalHash, 14 | causalParents :: Set CausalHash 15 | } 16 | deriving (Show) 17 | -------------------------------------------------------------------------------- /unison-cli/src/Unison/Codebase/Editor/Output/PushPull.hs: -------------------------------------------------------------------------------- 1 | module Unison.Codebase.Editor.Output.PushPull where 2 | 3 | data PushPull = Push | Pull deriving (Eq, Ord, Show) 4 | 5 | fold :: a -> a -> PushPull -> a 6 | fold push pull p = case p of 7 | Push -> push 8 | Pull -> pull 9 | -------------------------------------------------------------------------------- /unison-cli/src/Unison/Codebase/Editor/UCMVersion.hs: -------------------------------------------------------------------------------- 1 | module Unison.Codebase.Editor.UCMVersion where 2 | 3 | import Data.Text (Text) 4 | 5 | type UCMVersion = Text 6 | -------------------------------------------------------------------------------- /unison-cli/src/Unison/CommandLine/Types.hs: -------------------------------------------------------------------------------- 1 | module Unison.CommandLine.Types (ShouldWatchFiles (..)) where 2 | 3 | data ShouldWatchFiles 4 | = ShouldWatchFiles 5 | | ShouldNotWatchFiles 6 | deriving (Show, Eq) 7 | -------------------------------------------------------------------------------- /unison-cli/src/Unison/LSP/Orphans.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE PolyKinds #-} 2 | {-# LANGUAGE UndecidableInstances #-} 3 | {-# OPTIONS_GHC -Wno-orphans #-} 4 | 5 | -- | Instances for LSP types which are strangely missing. 6 | module Unison.LSP.Orphans where 7 | 8 | import Control.Lens 9 | import Language.LSP.Protocol.Lens (HasTextDocument (..), HasUri (..)) 10 | import Language.LSP.Protocol.Types 11 | 12 | instance HasTextDocument TextDocumentIdentifier TextDocumentIdentifier where 13 | textDocument = Prelude.id 14 | 15 | instance HasTextDocument VersionedTextDocumentIdentifier VersionedTextDocumentIdentifier where 16 | textDocument = Prelude.id 17 | 18 | instance HasUri NormalizedUri Uri where 19 | uri = iso fromNormalizedUri toNormalizedUri 20 | -------------------------------------------------------------------------------- /unison-cli/src/Unison/Version.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE OverloadedStrings #-} 2 | {-# LANGUAGE TemplateHaskell #-} 3 | 4 | module Unison.Version where 5 | 6 | import Data.Text (Text) 7 | 8 | data Version = Version {gitDescribeWithDate :: Text, gitDescribe :: (GitRef, CommitDate)} 9 | 10 | type CommitDate = Text 11 | 12 | type GitRef = Text 13 | -------------------------------------------------------------------------------- /unison-core/src/Unison/ConstructorType.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE DeriveGeneric #-} 2 | 3 | module Unison.ConstructorType where 4 | 5 | import Unison.Prelude 6 | 7 | data ConstructorType = Data | Effect deriving (Eq, Ord, Show, Enum, Generic) 8 | -------------------------------------------------------------------------------- /unison-core/src/Unison/DataDeclaration/ConstructorId.hs: -------------------------------------------------------------------------------- 1 | module Unison.DataDeclaration.ConstructorId (ConstructorId) where 2 | 3 | import Data.Word (Word64) 4 | 5 | type ConstructorId = Word64 6 | -------------------------------------------------------------------------------- /unison-core/src/Unison/Kind.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE DeriveGeneric #-} 2 | 3 | module Unison.Kind where 4 | 5 | import Unison.Prelude 6 | 7 | data Kind = Star | Arrow Kind Kind deriving (Eq, Ord, Read, Show, Generic) 8 | -------------------------------------------------------------------------------- /unison-core/src/Unison/Names/ResolvesTo.hs: -------------------------------------------------------------------------------- 1 | module Unison.Names.ResolvesTo 2 | ( ResolvesTo (..), 3 | partitionResolutions, 4 | ) 5 | where 6 | 7 | import Unison.Name (Name) 8 | import Unison.Prelude 9 | 10 | data ResolvesTo ref 11 | = ResolvesToNamespace ref 12 | | ResolvesToLocal Name 13 | deriving stock (Eq, Ord, Show) 14 | 15 | partitionResolutions :: [(v, ResolvesTo ref)] -> ([(v, ref)], [(v, Name)]) 16 | partitionResolutions = 17 | partitionEithers . map f 18 | where 19 | f = \case 20 | (v, ResolvesToNamespace ref) -> Left (v, ref) 21 | (v, ResolvesToLocal name) -> Right (v, name) 22 | -------------------------------------------------------------------------------- /unison-core/src/Unison/Position.hs: -------------------------------------------------------------------------------- 1 | module Unison.Position 2 | ( Position (..), 3 | ) 4 | where 5 | 6 | -- | An indicator of whether something is absolute, e.g. ".foo.bar", or relative, e.g. "foo.bar" 7 | data Position 8 | = Absolute 9 | | Relative 10 | deriving stock (Eq, Ord, Show) 11 | -------------------------------------------------------------------------------- /unison-core/src/Unison/Settings.hs: -------------------------------------------------------------------------------- 1 | module Unison.Settings where 2 | 3 | debugNoteLoc, debugNoteSummary, debugRevealForalls :: Bool 4 | debugNoteLoc = False 5 | debugNoteSummary = False 6 | debugRevealForalls = False 7 | 8 | renderTermMaxLength :: Int 9 | renderTermMaxLength = 30 10 | 11 | demoHideVarNumber :: Bool 12 | demoHideVarNumber = False 13 | 14 | removePureEffects :: Bool 15 | removePureEffects = True 16 | 17 | cleanupTypes :: Bool 18 | cleanupTypes = True 19 | -------------------------------------------------------------------------------- /unison-core/src/Unison/Util/Conflicted.hs: -------------------------------------------------------------------------------- 1 | module Unison.Util.Conflicted 2 | ( Conflicted (..), 3 | ) 4 | where 5 | 6 | import Data.Set.NonEmpty (NESet) 7 | 8 | -- | A conflicted thing. 9 | data Conflicted n a 10 | = Conflicted !n !(NESet a) 11 | -------------------------------------------------------------------------------- /unison-hashing-v2/src/Unison/Hashing/V2/Causal.hs: -------------------------------------------------------------------------------- 1 | module Unison.Hashing.V2.Causal 2 | ( Causal (..), 3 | ) 4 | where 5 | 6 | import Data.Set qualified as Set 7 | import Unison.Hash (Hash) 8 | import Unison.Hashing.ContentAddressable (ContentAddressable (..)) 9 | import Unison.Hashing.V2.Tokenizable qualified as H 10 | import Unison.Prelude 11 | 12 | data Causal = Causal {branchHash :: Hash, parents :: Set Hash} 13 | 14 | instance ContentAddressable Causal where 15 | contentHash = H.hashTokenizable 16 | 17 | instance H.Tokenizable Causal where 18 | tokens c = H.tokens $ branchHash c : Set.toList (parents c) 19 | -------------------------------------------------------------------------------- /unison-hashing-v2/src/Unison/Hashing/V2/ConstructorId.hs: -------------------------------------------------------------------------------- 1 | module Unison.Hashing.V2.ConstructorId 2 | ( ConstructorId, 3 | ) 4 | where 5 | 6 | import Data.Word (Word64) 7 | 8 | type ConstructorId = Word64 9 | -------------------------------------------------------------------------------- /unison-hashing-v2/src/Unison/Hashing/V2/Kind.hs: -------------------------------------------------------------------------------- 1 | module Unison.Hashing.V2.Kind 2 | ( Kind (..), 3 | ) 4 | where 5 | 6 | import Unison.Hashing.V2.Tokenizable (Tokenizable) 7 | import Unison.Hashing.V2.Tokenizable qualified as Hashable 8 | import Unison.Prelude 9 | 10 | data Kind 11 | = KindStar 12 | | KindArrow Kind Kind 13 | deriving (Eq, Ord, Read, Show, Generic) 14 | 15 | instance Tokenizable Kind where 16 | tokens k = case k of 17 | KindStar -> [Hashable.Tag 0] 18 | KindArrow k1 k2 -> (Hashable.Tag 1 : Hashable.tokens k1) ++ Hashable.tokens k2 19 | -------------------------------------------------------------------------------- /unison-hashing-v2/src/Unison/Hashing/V2/NameSegment.hs: -------------------------------------------------------------------------------- 1 | module Unison.Hashing.V2.NameSegment 2 | ( NameSegment (..), 3 | ) 4 | where 5 | 6 | import Unison.Hashing.V2.Tokenizable qualified as H 7 | import Unison.Prelude 8 | 9 | -- | A name segment. 10 | newtype NameSegment 11 | = NameSegment Text 12 | deriving stock (Eq, Ord, Show) 13 | 14 | instance H.Tokenizable NameSegment where 15 | tokens (NameSegment t) = [H.Text t] 16 | -------------------------------------------------------------------------------- /unison-hashing-v2/src/Unison/Hashing/V2/Referent.hs: -------------------------------------------------------------------------------- 1 | module Unison.Hashing.V2.Referent 2 | ( Referent (..), 3 | ) 4 | where 5 | 6 | import Unison.Hashing.V2.ConstructorId (ConstructorId) 7 | import Unison.Hashing.V2.Reference (Reference) 8 | import Unison.Hashing.V2.Tokenizable (Tokenizable) 9 | import Unison.Hashing.V2.Tokenizable qualified as H 10 | 11 | data Referent 12 | = ReferentRef Reference 13 | | ReferentCon Reference ConstructorId 14 | deriving stock (Show, Ord, Eq) 15 | 16 | instance Tokenizable Referent where 17 | tokens (ReferentRef r) = [H.Tag 0] ++ H.tokens r 18 | tokens (ReferentCon r i) = [H.Tag 2] ++ H.tokens r ++ H.tokens i 19 | -------------------------------------------------------------------------------- /unison-hashing-v2/src/Unison/Hashing/V2/TermEdit.hs: -------------------------------------------------------------------------------- 1 | module Unison.Hashing.V2.TermEdit (TermEdit (..)) where 2 | 3 | import Unison.Hashing.V2.Referent (Referent) 4 | import Unison.Hashing.V2.Tokenizable (Tokenizable) 5 | import Unison.Hashing.V2.Tokenizable qualified as H 6 | 7 | data TermEdit 8 | = TermEditReplace Referent 9 | | TermEditDeprecate 10 | deriving (Eq, Ord, Show) 11 | 12 | instance Tokenizable TermEdit where 13 | tokens (TermEditReplace r) = [H.Tag 0] ++ H.tokens r 14 | tokens TermEditDeprecate = [H.Tag 1] 15 | -------------------------------------------------------------------------------- /unison-hashing-v2/src/Unison/Hashing/V2/TypeEdit.hs: -------------------------------------------------------------------------------- 1 | module Unison.Hashing.V2.TypeEdit (TypeEdit (..)) where 2 | 3 | import Unison.Hashing.V2.Reference (Reference) 4 | import Unison.Hashing.V2.Tokenizable (Tokenizable) 5 | import Unison.Hashing.V2.Tokenizable qualified as H 6 | 7 | data TypeEdit 8 | = TypeEditReplace Reference 9 | | TypeEditDeprecate 10 | deriving (Eq, Ord, Show) 11 | 12 | instance Tokenizable TypeEdit where 13 | tokens (TypeEditReplace r) = H.Tag 0 : H.tokens r 14 | tokens TypeEditDeprecate = [H.Tag 1] 15 | -------------------------------------------------------------------------------- /unison-merge/src/Unison/Merge/EitherWay.hs: -------------------------------------------------------------------------------- 1 | module Unison.Merge.EitherWay 2 | ( EitherWay (..), 3 | swap, 4 | value, 5 | ) 6 | where 7 | 8 | -- | Alice exclusive-or Bob? 9 | data EitherWay a 10 | = Alice a 11 | | Bob a 12 | deriving stock (Eq, Functor, Show) 13 | 14 | swap :: EitherWay a -> EitherWay a 15 | swap = \case 16 | Alice x -> Bob x 17 | Bob x -> Alice x 18 | 19 | value :: EitherWay a -> a 20 | value = \case 21 | Alice x -> x 22 | Bob x -> x 23 | -------------------------------------------------------------------------------- /unison-merge/src/Unison/Merge/PartialDeclNameLookup.hs: -------------------------------------------------------------------------------- 1 | module Unison.Merge.PartialDeclNameLookup 2 | ( PartialDeclNameLookup (..), 3 | ) 4 | where 5 | 6 | import Unison.Name (Name) 7 | import Unison.Prelude 8 | 9 | -- | Like a @DeclNameLookup@, but "partial" / more lenient - because we don't require the LCA of a merge to have a full 10 | -- @DeclNameLookup@. 11 | data PartialDeclNameLookup = PartialDeclNameLookup 12 | { constructorToDecl :: !(Map Name Name), 13 | declToConstructors :: !(Map Name [Maybe Name]) 14 | } 15 | deriving stock (Generic) 16 | -------------------------------------------------------------------------------- /unison-merge/src/Unison/Merge/Synhashed.hs: -------------------------------------------------------------------------------- 1 | module Unison.Merge.Synhashed 2 | ( Synhashed (..), 3 | ) 4 | where 5 | 6 | import Unison.Hash (Hash) 7 | import Unison.Prelude 8 | 9 | -- | A small utility type that represents a syntactic-hashed thing. 10 | -- 11 | -- The `Eq` and `Ord` instances only compares syntactic hashes. 12 | data Synhashed a = Synhashed 13 | { hash :: !Hash, 14 | value :: !a 15 | } 16 | deriving stock (Functor, Generic, Show) 17 | 18 | instance Eq (Synhashed a) where 19 | Synhashed x _ == Synhashed y _ = 20 | x == y 21 | 22 | instance Ord (Synhashed a) where 23 | compare (Synhashed x _) (Synhashed y _) = 24 | compare x y 25 | -------------------------------------------------------------------------------- /unison-merge/src/Unison/Merge/ThreeWay.hs: -------------------------------------------------------------------------------- 1 | module Unison.Merge.ThreeWay 2 | ( ThreeWay (..), 3 | forgetLca, 4 | toTwoOrThreeWay, 5 | ) 6 | where 7 | 8 | import Unison.Merge.Internal.Types (ThreeWay (..)) 9 | import Unison.Merge.TwoOrThreeWay (TwoOrThreeWay (..)) 10 | import Unison.Merge.TwoWay (TwoWay (..)) 11 | 12 | forgetLca :: ThreeWay a -> TwoWay a 13 | forgetLca ThreeWay {alice, bob} = 14 | TwoWay {alice, bob} 15 | 16 | toTwoOrThreeWay :: ThreeWay a -> TwoOrThreeWay a 17 | toTwoOrThreeWay ThreeWay {alice, bob, lca} = 18 | TwoOrThreeWay {alice, bob, lca = Just lca} 19 | -------------------------------------------------------------------------------- /unison-merge/src/Unison/Merge/TwoOrThreeWay.hs: -------------------------------------------------------------------------------- 1 | module Unison.Merge.TwoOrThreeWay 2 | ( TwoOrThreeWay (..), 3 | toThreeWay, 4 | ) 5 | where 6 | 7 | import Unison.Merge.Internal.Types (ThreeWay (..), TwoOrThreeWay (..)) 8 | import Unison.Prelude 9 | 10 | toThreeWay :: a -> TwoOrThreeWay a -> ThreeWay a 11 | toThreeWay x TwoOrThreeWay {alice, bob, lca} = 12 | ThreeWay {alice, bob, lca = fromMaybe x lca} 13 | -------------------------------------------------------------------------------- /unison-merge/src/Unison/Merge/Updated.hs: -------------------------------------------------------------------------------- 1 | module Unison.Merge.Updated 2 | ( Updated (..), 3 | ) 4 | where 5 | 6 | import Unison.Prelude 7 | 8 | -- | An updated thing. 9 | data Updated a = Updated 10 | { old :: a, 11 | new :: a 12 | } 13 | deriving stock (Foldable, Functor, Generic, Show, Traversable) 14 | -------------------------------------------------------------------------------- /unison-share-api/README.md: -------------------------------------------------------------------------------- 1 | # unison-share-api 2 | 3 | This package serves as a shared place to store the API definitions and types 4 | for all of Share's APIs. This facilitates the use of `servant-client` to easily 5 | generate clients for the API, and provides an always-up-to-date view of Share's APIs. 6 | -------------------------------------------------------------------------------- /unison-share-api/src/Unison/Server/Local/Endpoints/UCM.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE DataKinds #-} 2 | 3 | module Unison.Server.Local.Endpoints.UCM where 4 | 5 | import Unison.Codebase (Codebase) 6 | import Unison.Prelude 7 | import Unison.Server.Backend 8 | import Unison.Server.Local.Endpoints.Current (Current, CurrentEndpoint, serveCurrent) 9 | 10 | -- API endpoints which have to do with interacting with UCM directly. 11 | type UCMAPI = 12 | CurrentEndpoint 13 | 14 | ucmServer :: (MonadIO m) => Codebase m v a -> Backend m Current 15 | ucmServer codebase = serveCurrent codebase 16 | -------------------------------------------------------------------------------- /unison-share-api/src/Unison/Server/QueryResult.hs: -------------------------------------------------------------------------------- 1 | module Unison.Server.QueryResult where 2 | 3 | import Unison.HashQualified qualified as HQ 4 | import Unison.Name (Name) 5 | import Unison.Server.SearchResult qualified as SR 6 | 7 | data QueryResult = QueryResult 8 | { misses :: [HQ.HashQualified Name], 9 | hits :: [SR.SearchResult] 10 | } 11 | -------------------------------------------------------------------------------- /unison-share-api/tests/Main.hs: -------------------------------------------------------------------------------- 1 | module Main where 2 | 3 | import EasyTest 4 | import System.Environment (getArgs) 5 | import System.IO 6 | import System.IO.CodePage (withCP65001) 7 | import Unison.Test.Sync.Roundtrip qualified as SyncRoundtrip 8 | 9 | test :: Test () 10 | test = 11 | tests 12 | [ SyncRoundtrip.test 13 | ] 14 | 15 | main :: IO () 16 | main = withCP65001 do 17 | args <- getArgs 18 | mapM_ (`hSetEncoding` utf8) [stdout, stdin, stderr] 19 | case args of 20 | [] -> runOnly "" test 21 | [prefix] -> runOnly prefix test 22 | [seed, prefix] -> rerunOnly (read seed) prefix test 23 | _ -> error "expected no args, a prefix, or a seed and a prefix" 24 | -------------------------------------------------------------------------------- /unison-src/builtin-tests/Readme.md: -------------------------------------------------------------------------------- 1 | # Test suite for builtins 2 | 3 | Edit `tests.u` in this directory to add to the test suite. The same test suite can be run using the JIT or the interpreter, using either of the two scripts: 4 | 5 | ```bash 6 | $ ./unison-src/builtin-tests/jit-tests.sh $(stack exec which unison) --runtime-path 7 | ``` 8 | 9 | ```bash 10 | $ ./unison-src/builtin-tests/interpreter-tests.sh 11 | ``` 12 | 13 | The scripts will fetch a copy of base and the scheme codegen library and cache it for subsequent runs. 14 | -------------------------------------------------------------------------------- /unison-src/builtin-tests/base.md: -------------------------------------------------------------------------------- 1 | When this file is modified, CI will create a new codebase and re-run this; 2 | otherwise it may reuse a previously cached codebase. 3 | 4 | Thus, make sure the contents of this file define the contents of the cache 5 | (e.g. don't pull `latest`.) 6 | 7 | ``` ucm 8 | scratch/main> pull @unison/base/releases/2.5.0 .base 9 | scratch/main> builtins.mergeio 10 | scratch/main> undo 11 | ``` 12 | -------------------------------------------------------------------------------- /unison-src/builtin-tests/interpreter-tests.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -ex 3 | 4 | if [ -z "$1" ]; then 5 | ucm=$(stack exec -- which unison) 6 | else 7 | ucm="$1" 8 | fi 9 | 10 | runtime_tests_version="@unison/runtime-tests/releases/0.0.3" 11 | 12 | codebase=${XDG_CACHE_HOME:-"$HOME/.cache"}/unisonlanguage/runtime-tests.unison 13 | 14 | runtime_tests_version="$runtime_tests_version" \ 15 | envsubst '$runtime_tests_version' \ 16 | < unison-src/builtin-tests/interpreter-tests.tpl.md \ 17 | > unison-src/builtin-tests/interpreter-tests.md 18 | time "$ucm" transcript.fork -C $codebase -S $codebase unison-src/builtin-tests/interpreter-tests.md 19 | -------------------------------------------------------------------------------- /unison-src/demo/1.u: -------------------------------------------------------------------------------- 1 | increment : Nat -> Nat 2 | increment n = n + 1 3 | 4 | > x = 1 + 40 5 | > increment x -------------------------------------------------------------------------------- /unison-src/errors/407.u: -------------------------------------------------------------------------------- 1 | use Universal < 2 | 3 | foo : x -> x -> Nat 4 | foo x y = 42 5 | 6 | 7 | > foo "hi" 2 8 | 9 | -------------------------------------------------------------------------------- /unison-src/errors/X-array.u: -------------------------------------------------------------------------------- 1 | structural type X = S Text | I Nat 2 | 3 | foo : a -> b -> c -> X 4 | foo x y z = X.S "" 5 | 6 | [foo +1 1 1.0, 1] 7 | -------------------------------------------------------------------------------- /unison-src/errors/abort-ability-checks-against-pure.u: -------------------------------------------------------------------------------- 1 | --Abort 2 | structural ability Abort where 3 | Abort : forall a . () -> {Abort} a 4 | 5 | bork = u -> 1 + (Abort.Abort ()) 6 | 7 | (bork : () -> {} Nat) 8 | 9 | -- failing to fail in commit 2819c206acf80f926c6d970a4ffd47c961fa4502 10 | -------------------------------------------------------------------------------- /unison-src/errors/check-for-regressions/and.u: -------------------------------------------------------------------------------- 1 | and true 3 2 | 3 | -- InSubtype t1=Nat, t2=Boolean 4 | -- InCheck e=3, t=Boolean 5 | -- InSynthesizeApp t=Boolean -> Boolean, e=3, n=2 6 | -- InAndApp 7 | -- InSynthesize e=and true 3 8 | -------------------------------------------------------------------------------- /unison-src/errors/check-for-regressions/app-polymorphic.u: -------------------------------------------------------------------------------- 1 | foo : a -> a -> a -> a -> a -> a 2 | foo a b c d e = e 3 | 4 | foo 1 2 3 "ha" 5 5 | -------------------------------------------------------------------------------- /unison-src/errors/check-for-regressions/app.u: -------------------------------------------------------------------------------- 1 | foo : Nat -> Nat -> Nat -> Nat -> Nat -> Nat 2 | foo a b c d e = a + b + c + d + e 3 | 4 | foo 1 2 3 "ha" 5 5 | -------------------------------------------------------------------------------- /unison-src/errors/check-for-regressions/applying-non-function.u: -------------------------------------------------------------------------------- 1 | -- "Hello" "world" 2 | 3 | id a = a 4 | id 1 1 5 | -------------------------------------------------------------------------------- /unison-src/errors/check-for-regressions/casebody.u: -------------------------------------------------------------------------------- 1 | match 3 with 2 | 3 -> 4 3 | 4 -> "Surprise!" 4 | -------------------------------------------------------------------------------- /unison-src/errors/check-for-regressions/caseguard.u: -------------------------------------------------------------------------------- 1 | match 3 with 2 | 3 | 3 -> 4 3 | -------------------------------------------------------------------------------- /unison-src/errors/check-for-regressions/casepattern.u: -------------------------------------------------------------------------------- 1 | match 3 with 2 | 3 -> "Great!" 3 | "Great" -> "Terrible." 4 | -------------------------------------------------------------------------------- /unison-src/errors/check-for-regressions/ifcond.u: -------------------------------------------------------------------------------- 1 | if 3 then 4 else 5 2 | -------------------------------------------------------------------------------- /unison-src/errors/check-for-regressions/ifelse.u: -------------------------------------------------------------------------------- 1 | if true then 4 else "Surprise!" 2 | -------------------------------------------------------------------------------- /unison-src/errors/check-for-regressions/lens.u: -------------------------------------------------------------------------------- 1 | structural type Foo a b = Foo a b 2 | use Foo Foo 3 | use Optional Some 4 | setA : Foo a b -> Optional a -> Foo a b 5 | setA foo a = match (foo, a) with 6 | (Foo _ b, Some a) -> Foo a b 7 | _ -> foo 8 | 9 | setA (Foo "hello" 3) (Some 7) 10 | -------------------------------------------------------------------------------- /unison-src/errors/check-for-regressions/not-and.u: -------------------------------------------------------------------------------- 1 | notid : Int -> Boolean 2 | notid a = true 3 | and (notid 3) true 4 | 5 | -- InSubtype t1=Nat, t2=Int 6 | -- InCheck e=3, t=Int 7 | -- InSynthesizeApp t=Int -> Boolean, e=3, n=1 8 | -- InSynthesizeApps f=notid1 ft=Int -> Boolean, es=[3] 9 | -- InSynthesize e=notid1 3 10 | -- InCheck e=notid1 3, t=Boolean 11 | -- InSynthesizeApp t=Boolean -> Boolean -> Boolean, e=notid1 3, n=1 12 | -- InAndApp 13 | -- InSynthesize e=and notid1 3 true 14 | -- InSynthesize e=Cycle (notid. (let r... 15 | -------------------------------------------------------------------------------- /unison-src/errors/check-for-regressions/not-and0.u: -------------------------------------------------------------------------------- 1 | and (3 : Boolean) true 2 | 3 | -- InSubtype t1=Nat, t2=Boolean 4 | -- InCheck e=3, t=Boolean 5 | -- InSynthesize e=3:Boolean 6 | -- InCheck e=3:Boolean, t=Boolean 7 | -- InSynthesizeApp t=Boolean -> Boolean -> Boolean, e=3:Boolean, n=1 8 | -- InAndApp 9 | -- InSynthesize e=and 3:Boolean true 10 | -------------------------------------------------------------------------------- /unison-src/errors/check-for-regressions/not-caseguard.u: -------------------------------------------------------------------------------- 1 | notid : Int -> Boolean 2 | notid a = true 3 | match 3 with 4 | 3 | notid 3 -> 4 5 | -------------------------------------------------------------------------------- /unison-src/errors/check-for-regressions/not-caseguard2.u: -------------------------------------------------------------------------------- 1 | match 3 with 2 | 3 | (3 : Boolean) -> 4 3 | -------------------------------------------------------------------------------- /unison-src/errors/check-for-regressions/not-or.u: -------------------------------------------------------------------------------- 1 | or (3 : Boolean) true 2 | -------------------------------------------------------------------------------- /unison-src/errors/check-for-regressions/not-vector.u: -------------------------------------------------------------------------------- 1 | [1, +1 : Nat] 2 | -------------------------------------------------------------------------------- /unison-src/errors/check-for-regressions/or.u: -------------------------------------------------------------------------------- 1 | or true 3 2 | -------------------------------------------------------------------------------- /unison-src/errors/check-for-regressions/vector.u: -------------------------------------------------------------------------------- 1 | [1, +1] 2 | -------------------------------------------------------------------------------- /unison-src/errors/compiler-bug.u: -------------------------------------------------------------------------------- 1 | x = 1 2 | Foo.y = 4.0 3 | a = 4 | x + y 5 | () 6 | -------------------------------------------------------------------------------- /unison-src/errors/cyclic-unguarded.u: -------------------------------------------------------------------------------- 1 | 2 | x = y + 1 3 | y = x + 1 4 | 5 | > x 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /unison-src/errors/effect-inference1.u: -------------------------------------------------------------------------------- 1 | structural ability Abort where 2 | Abort : forall a . () -> {Abort} a 3 | 4 | foo n = if n >= 1000 then n else !Abort.Abort 5 | 6 | bar : (Nat -> {} Nat) -> Nat -> Nat 7 | bar f i = f i 8 | 9 | bar foo 3 10 | 11 | -- as of 3935b366383fe8184f96cfe714c31ca04234cf27, this typechecks (unexpected) 12 | -- and then bombs in the runtime because the Abort ability isn't handled. 13 | -------------------------------------------------------------------------------- /unison-src/errors/effect_unknown_type.uu: -------------------------------------------------------------------------------- 1 | structural ability T where 2 | a : Unknown -> {T} () 3 | 4 | --b : Unknown 5 | --b = () 6 | 7 | ---- 8 | 9 | unison: can't hashComponents if bindings have free variables: 10 | ["Unknown"] 11 | ["T"] 12 | CallStack (from HasCallStack): 13 | error, called at src/Unison/ABT.hs:504:11 in unison-parser-typechecker-0.1-I7C95FdIglBGnISbV534LW:Unison.ABT 14 | 15 | -- Typechecker emits a helpful error about b's use of an unknown type, but not a's. 16 | -- 17 | -- Error for b: 18 | -- typechecker.tests/ability_unknown_type.u FAILURE I don't know about the type Unknown. Make sure it's imported and spelled correctly: 19 | -- 20 | -- 22 | b : Unknown 21 | -------------------------------------------------------------------------------- /unison-src/errors/empty-block.u: -------------------------------------------------------------------------------- 1 | foo = 2 | -------------------------------------------------------------------------------- /unison-src/errors/fix745.u: -------------------------------------------------------------------------------- 1 | 2 | unique ability A where a : Nat 3 | unique ability B where b : Nat 4 | 5 | noGood : Nat ->{A} '{B} () 6 | noGood n unit = 7 | -- The A.a should be an ability check failure, since we are in the body 8 | -- of an arrow which only has the {B} ability set. 9 | A.a 10 | B.b 11 | () 12 | 13 | ok : Nat ->{A} '{B} () 14 | ok n = 15 | -- This is okay, because the A.a is being evaluated in the body of an 16 | -- arrow with {A}. The result of the body is another lambda which 17 | -- is allowed {B} requests by type signature of `ok`. 18 | A.a 19 | 'let B.b; () 20 | -------------------------------------------------------------------------------- /unison-src/errors/handler-coverage-checking.uu: -------------------------------------------------------------------------------- 1 | --State3 ability 2 | structural ability State se2 where 3 | put : ∀ se . se -> {State se} () 4 | get : ∀ se . () -> {State se} se 5 | 6 | state : ∀ s a . s -> Request (State s) a -> (s, a) 7 | state woot = cases 8 | { State.get () -> k } -> handle k woot with state woot 9 | { State.put snew -> k } -> handle k () with state snew 10 | 11 | ex1 : (Nat, Nat) 12 | ex1 = handle State.get () with state 42 13 | 14 | ex1a : (Nat, Nat) 15 | ex1a = handle 49 with state 42 16 | 17 | ex1b = handle 0 with x -> 10 18 | 19 | ex1c : Nat 20 | ex1c = handle 0 with x -> 10 21 | 22 | ex1d = handle 49 with state 42 23 | 24 | ex2 = handle State.get () with state 42 25 | 26 | ex3 : (Nat, Nat) 27 | ex3 = ex2 28 | 29 | () 30 | -------------------------------------------------------------------------------- /unison-src/errors/id.u: -------------------------------------------------------------------------------- 1 | id a = a 2 | 3 | (id 42 : Text) 4 | -------------------------------------------------------------------------------- /unison-src/errors/io-effect.u: -------------------------------------------------------------------------------- 1 | --IO ability 2 | structural ability IO where 3 | launchMissiles : () -> {IO} () 4 | -- binding is not guarded by a lambda, it only can access 5 | -- ambient abilities (which will be empty) 6 | ex1 : {IO} () 7 | ex1 = IO.launchMissiles() 8 | () 9 | 10 | -------------------------------------------------------------------------------- /unison-src/errors/io-state1.u: -------------------------------------------------------------------------------- 1 | --IO/State1 ability 2 | structural ability IO where 3 | launchMissiles : {IO} () 4 | structural ability State se2 where 5 | put : ∀ se . se -> {State se} () 6 | get : ∀ se . () -> {State se} se 7 | foo : () -> {IO} () 8 | foo unit = 9 | -- inner binding can't access outer abilities unless it declares 10 | -- them explicitly 11 | incBy : Int -> {State Int} () 12 | incBy i = 13 | launchMissiles -- not allowed 14 | y = State.get() 15 | State.put (y Int.+ i) 16 | () 17 | () 18 | -------------------------------------------------------------------------------- /unison-src/errors/map-traverse3.u: -------------------------------------------------------------------------------- 1 | --map/traverse 2 | structural ability Noop where 3 | noop : a -> {Noop} a 4 | 5 | structural type List a = Nil | Cons a (List a) 6 | 7 | map : (a ->{} b) -> List a -> List b 8 | map f = cases 9 | List.Nil -> List.Nil 10 | List.Cons h t -> List.Cons (f h) (map f t) 11 | 12 | c = List.Cons 13 | 14 | z : ∀ a . List a 15 | z = List.Nil 16 | 17 | ex = c 1 (c 2 (c 3 z)) 18 | 19 | pureMap : List Text 20 | pureMap = map (a -> "hello") ex 21 | 22 | -- this should not typecheck because map is annotated to take a pure function 23 | zappy : '{Noop} (List Nat) 24 | zappy = 'let map (zap -> Noop.noop (zap Nat.+ 1)) ex 25 | 26 | pureMap 27 | -------------------------------------------------------------------------------- /unison-src/errors/mismatched-braces.u: -------------------------------------------------------------------------------- 1 | } 2 | 3 | x = 3 4 | 5 | -------------------------------------------------------------------------------- /unison-src/errors/need-nominal-type.uu: -------------------------------------------------------------------------------- 1 | structural type Foo = Foo 2 | structural type Bar = Bar 3 | 4 | x : Foo 5 | x = Bar.Bar 6 | 7 | x 8 | -------------------------------------------------------------------------------- /unison-src/errors/poor-error-message/doesnt-match-annotation.u: -------------------------------------------------------------------------------- 1 | crazyTuple : a -> b -> (a,b)-- -> (a,b) 2 | crazyTuple a b c = c 3 | 4 | () 5 | 6 | -------------------------------------------------------------------------------- /unison-src/errors/poor-error-message/function-calls.u: -------------------------------------------------------------------------------- 1 | f1 : Int -> Int 2 | f1 n = n + +1 3 | 4 | f1 (3 Nat.+ 3) 5 | 6 | -- idea: 7 | -- I was expecting Int 8 | -- vs 9 | -- f1 was expecting Int 10 | 11 | -- "In the call below" vs "In the call to `foo`" 12 | -------------------------------------------------------------------------------- /unison-src/errors/poor-error-message/function-calls1.u: -------------------------------------------------------------------------------- 1 | f1 : Int -> Int 2 | f1 n = n + +1 3 | 4 | f1 (3 Nat.+ 3) 5 | 6 | -- issues: 7 | -- - the highlight term is '3' but should be (3 + 3) 8 | -- - 9 | 10 | 11 | -- Paul Thought: 12 | -- Whenever we synthesize a type, we can set the location 13 | -- of the synthesized type to be the location of the 14 | -- synthesized expression. 15 | -- Arya & Runar: isn't that what we already do 16 | -- Paul: No, we only something something when we refine an existential 17 | -------------------------------------------------------------------------------- /unison-src/errors/poor-error-message/function-calls2.u: -------------------------------------------------------------------------------- 1 | id : a -> a 2 | id a = a 3 | 4 | f1 : Int -> Int 5 | f1 n = n + +1 6 | 7 | f1 (id 3) 8 | 9 | -- issues: 10 | -- - the highlight term is '3' but should be (3 + 3) 11 | -- - 12 | 13 | 14 | -- Paul Thought: 15 | -- Whenever we synthesize a type, we can set the location 16 | -- of the synthesized type to be the location of the 17 | -- synthesized expression. 18 | -- Arya & Runar: isn't that what we already do 19 | -- Paul: No, we only something something when we refine an existential 20 | -------------------------------------------------------------------------------- /unison-src/errors/poor-error-message/function-calls3.u: -------------------------------------------------------------------------------- 1 | -- first : a -> a -> a 2 | -- first a b = a 3 | 4 | id5 : a -> a -> a -> a -> a -> (a,a,a,a,a) 5 | id5 a b c d e = (a, b, c, d, e) 6 | 7 | -- second : a -> a -> a 8 | -- second a b = b 9 | 10 | id5 1 +2 3 4 5 11 | 12 | -- (match true with 13 | -- true -> first 14 | -- false -> second) 1 +2 15 | 16 | -- issues: 17 | -- - the highlight term is '3' but should be (3 + 3) 18 | -- - 19 | 20 | 21 | -- Paul Thought: 22 | -- Whenever we synthesize a type, we can set the location 23 | -- of the synthesized type to be the location of the 24 | -- synthesized expression. 25 | -- Arya & Runar: isn't that what we already do 26 | -- Paul: No, we only something something when we refine an existential 27 | -------------------------------------------------------------------------------- /unison-src/errors/poor-error-message/mismatched-case-result-types.u: -------------------------------------------------------------------------------- 1 | --mismatched case result types 2 | structural type Optional a = None | Some a 3 | match Optional.Some 3 with 4 | x -> 1 5 | y -> "boo" 6 | 7 | -- as of 5ae98f7, produces this message: 8 | 9 | --Each case of a match/with expression need to have the same type. 10 | -- Here, one is Nat, and another is Text: 11 | -- 12 | -- 4 | x -> 1 -- x is highlighted 13 | -- 5 | y -> "boo" -- "boo" is highlighted 14 | -- 15 | -- from right here: 16 | -- 17 | -- 4 | x -> 1 -- 1 is highlighted 18 | 19 | -- IMO, 1 should be highlighted instead of x on line 12; 20 | -- then lines 14-17 would be omitted. 21 | -------------------------------------------------------------------------------- /unison-src/errors/poor-error-message/notaguard.u: -------------------------------------------------------------------------------- 1 | -- Getting the error 2 | --The guard expression for a case has to be Boolean, but this one is a7: 3 | -- 4 | -- 13 | {Ask.ask -> k} -> handle k () with supply t 5 | -- 6 | -- from right here: 7 | -- 8 | -- 8 | supply : Text -> Request (Ask Text) a -> a 9 | -- 10 | -- 11 | -- even though this program doesn't use guards! 12 | 13 | structural ability Ask a where 14 | ask : {Ask a} a 15 | 16 | supply : Text -> Request (Ask Text) a -> a 17 | supply t = cases 18 | {a} -> "foo" -- a 19 | {Ask.ask -> k} -> handle k () with supply t 20 | 21 | () 22 | -------------------------------------------------------------------------------- /unison-src/errors/poor-error-message/overapplied-data-constructor-loc.u: -------------------------------------------------------------------------------- 1 | -- board piece 2 | structural type P = X | O | E 3 | 4 | structural type Board = Board P P 5 | 6 | use Board.Board 7 | use P O X E 8 | 9 | match Board X O X 10 | with Board a b c -> a 11 | 12 | 13 | -- gives this error: 14 | -- This looks like a function call, but with a Board where the function should be. Are you missing an operator? 15 | -- ^^^^^ 16 | -- 13 | match Board X O X 17 | -- ^^^^^ 18 | -------------------------------------------------------------------------------- /unison-src/errors/poor-error-message/pattern-case-location.u: -------------------------------------------------------------------------------- 1 | -- The location of the error is imprecise. It should point to 2 | -- the pattern `Bar.Bar`. 3 | 4 | unique type Foo = Foo 5 | unique type Bar = Bar 6 | 7 | foo : Foo -> Foo 8 | foo = cases 9 | Foo.Foo -> Foo 10 | Bar.Bar -> Foo 11 | -------------------------------------------------------------------------------- /unison-src/errors/poor-error-message/pattern-matching-1.u: -------------------------------------------------------------------------------- 1 | structural type Foo0 = Foo0 2 | structural type Foo1 a = Foo1 a 3 | structural type Foo2 a b = Foo2 a b 4 | structural type Foo3 a b c = Foo3 a b c 5 | 6 | use Foo0 Foo0 7 | use Foo1 Foo1 8 | use Foo2 Foo2 9 | 10 | x = match Foo0 with 11 | Foo0 -> 1 12 | 13 | y = match Foo1 1 with 14 | Foo1 1 -> 0 15 | Foo1 _ -> 10 16 | 17 | z = match Foo2 1 "hi" with 18 | Foo2 x _ -> x 19 | Foo2 1 _ -> 1 20 | 21 | w = match Foo3.Foo3 1 2 "bye" with 22 | Foo3.Foo3 1 2 x -> Text.concatenate x "bye" 23 | -- where the heck are these locations coming from? 24 | -- I feel, since concatenate isn't polymorphic, that `Text` 25 | -- should come from there, not from `x`. 26 | _ -> () 27 | 28 | () 29 | -------------------------------------------------------------------------------- /unison-src/errors/rank2a.u: -------------------------------------------------------------------------------- 1 | 2 | -- We expect this to not typecheck since a `Nat -> Nat` cannot 3 | -- be passed where a `∀ a . a -> a` is expected. 4 | rank2a : (Nat -> Nat) -> Nat 5 | rank2a = 6 | inner : (∀ a . a -> a) -> Nat 7 | inner f = 42 8 | inner 9 | -------------------------------------------------------------------------------- /unison-src/errors/seq-concat-constant-length.u: -------------------------------------------------------------------------------- 1 | test : [a] -> ([a], [a]) 2 | test l = match l with 3 | x ++ y -> (x, y) 4 | -------------------------------------------------------------------------------- /unison-src/errors/state4.u: -------------------------------------------------------------------------------- 1 | --State4 ability 2 | structural ability State se2 where 3 | put : ∀ se . se -> {State se} () 4 | get : ∀ se . () -> {State se} se 5 | -- binding is not guarded by a lambda, it only can access 6 | -- ambient abilities (which will be empty) 7 | ex1 : {State Int} () 8 | ex1 = 9 | y = State.get 10 | State.put (y Int.+ +1) 11 | () 12 | () 13 | 14 | -------------------------------------------------------------------------------- /unison-src/errors/tdnr.u: -------------------------------------------------------------------------------- 1 | foo a b = a + b 2 | 3 | foo 4 | -------------------------------------------------------------------------------- /unison-src/errors/tdnr2.u: -------------------------------------------------------------------------------- 1 | 2.0 + 4 2 | -------------------------------------------------------------------------------- /unison-src/errors/tdnr3.u: -------------------------------------------------------------------------------- 1 | -- + Should get resolved to Nat.+, making this fail 2 | 3 | x : Nat 4 | x = 42 5 | 6 | Foo.z : Float 7 | Foo.z = 4.0 8 | 9 | a = x + z 10 | 11 | -------------------------------------------------------------------------------- /unison-src/errors/term-functor-inspired/effect1.u: -------------------------------------------------------------------------------- 1 | structural ability State s where 2 | get : () -> {State s} s 3 | set : s -> {State s} () 4 | 5 | x : {State Nat} Nat 6 | x = 7 | State.get () 8 | 9 | () 10 | -------------------------------------------------------------------------------- /unison-src/errors/term-functor-inspired/if-body-mismatch.u: -------------------------------------------------------------------------------- 1 | if true 2 | then 1 3 | else 1.0 4 | -------------------------------------------------------------------------------- /unison-src/errors/term-functor-inspired/if-cond-not-bool.u: -------------------------------------------------------------------------------- 1 | if "true" then 1 else 1 2 | -------------------------------------------------------------------------------- /unison-src/errors/term-functor-inspired/mismatched-case-result-types.u: -------------------------------------------------------------------------------- 1 | --mismatched case result types 2 | structural type Optional a = None | Some a 3 | match Optional.Some 3 with 4 | x -> 1 5 | y -> "boo" 6 | -------------------------------------------------------------------------------- /unison-src/errors/type-apply.u: -------------------------------------------------------------------------------- 1 | --Type.apply 2 | structural type List a = Nil | Cons a (List a) 3 | map : ∀ a b . (a -> b) -> List a -> List b 4 | map f = cases 5 | List.Nil -> List.Nil 6 | List.Cons h t -> List.Cons h (map f t) -- should not typecheck, missing (f h) 7 | -- definitely should not typecheck! 8 | map2 : ∀ a . a 9 | map2 = map 10 | c = List.Cons 11 | z = List.Nil 12 | ex = c 1 (c 2 (c 3 z)) 13 | pureMap : List Int -- should fail, output is a `List Text` 14 | pureMap = map (a -> "hi") ex 15 | () 16 | -------------------------------------------------------------------------------- /unison-src/errors/type-functor-inspired/app2.u: -------------------------------------------------------------------------------- 1 | structural type Optional a = Some a | None 2 | app' : Optional Int 3 | app' = 3 4 | () 5 | -------------------------------------------------------------------------------- /unison-src/errors/type-functor-inspired/arrow1.u: -------------------------------------------------------------------------------- 1 | arrow : Int -> Int -> Int 2 | arrow a = 3 3 | () -------------------------------------------------------------------------------- /unison-src/errors/type-functor-inspired/effect2.u: -------------------------------------------------------------------------------- 1 | structural ability Abort where 2 | Abort : forall a . () -> {Abort} a 3 | 4 | structural ability Abort2 where 5 | Abort2 : forall a . () -> {Abort2} a 6 | Abort2' : forall a . () -> {Abort2} a 7 | 8 | ability' : Nat -> { Abort } Int 9 | ability' n = Abort2.Abort2 () 10 | 11 | () 12 | -------------------------------------------------------------------------------- /unison-src/errors/type-functor-inspired/forall-arrow.u: -------------------------------------------------------------------------------- 1 | id : forall a . a -> a 2 | id x = 3 3 | () 4 | -------------------------------------------------------------------------------- /unison-src/errors/type-functor-inspired/forall-arrow2.u: -------------------------------------------------------------------------------- 1 | f2 : forall a . a -> a -> a 2 | f2 x = x 3 | 4 | () -------------------------------------------------------------------------------- /unison-src/errors/type-functor-inspired/forall-arrow3.u: -------------------------------------------------------------------------------- 1 | const : forall a b . a -> b -> a 2 | const a b = 3 3 | 4 | () -------------------------------------------------------------------------------- /unison-src/errors/type-functor-inspired/need-nonstructural-types.uu: -------------------------------------------------------------------------------- 1 | structural ability Abort where 2 | Abort : forall a . () -> {Abort} a 3 | 4 | structural ability Abort2 where 5 | Abort2 : forall a . () -> {Abort2} a 6 | 7 | ability' : Nat -> { Abort } Int 8 | ability' n = Abort2.Abort2 () 9 | 10 | () 11 | 12 | -- oops, Abort and Abort2 end up being synonyms 13 | -------------------------------------------------------------------------------- /unison-src/errors/type-functor-inspired/parens.u: -------------------------------------------------------------------------------- 1 | structural type Optional a = Some a | None 2 | y : (Optional Int) 3 | y = 3 4 | () -------------------------------------------------------------------------------- /unison-src/errors/type-functor-inspired/subtuple.u: -------------------------------------------------------------------------------- 1 | structural type Optional a = Some a | None 2 | z' : (Optional Int, Optional Text, Optional Float) 3 | z' = (None, 3) 4 | 5 | () -------------------------------------------------------------------------------- /unison-src/errors/type-functor-inspired/synthesizeApp.u: -------------------------------------------------------------------------------- 1 | foo : a -> a -> Nat 2 | foo x z = 42 3 | 4 | foo +1 "hi" 5 | -------------------------------------------------------------------------------- /unison-src/errors/type-functor-inspired/tuple.u: -------------------------------------------------------------------------------- 1 | structural type Optional a = Some a | None 2 | z : (Optional Int, Optional Text, Optional Float) 3 | z = 3 4 | () -------------------------------------------------------------------------------- /unison-src/errors/type-functor-inspired/tuple2.u: -------------------------------------------------------------------------------- 1 | y : (Nat, Optional Int, Text) 2 | y = (42, 3, "") 3 | y 4 | -------------------------------------------------------------------------------- /unison-src/errors/type-functor-inspired/unit.u: -------------------------------------------------------------------------------- 1 | x : () 2 | x = 3 3 | () 4 | -------------------------------------------------------------------------------- /unison-src/errors/unexpected-loop.u: -------------------------------------------------------------------------------- 1 | --Abort 2 | structural ability Abort where 3 | Abort : forall a . () -> {Abort} a 4 | 5 | use Nat + 6 | 7 | bork = u -> 1 + (Abort.Abort ()) 8 | 9 | (bork : Nat) 10 | 11 | -- fails with loop instead of with type mismatch in commit 2819c206acf80f926c6d970a4ffd47c961fa4502 12 | -------------------------------------------------------------------------------- /unison-src/errors/unresolved-symbol-1.u: -------------------------------------------------------------------------------- 1 | let 2 | (|>) : a -> (a -> WHat) -> b -- unresolved symbol 3 | a |> f = f a 4 | Stream.fromInt -3 5 | |> Stream.take 10 6 | |> Stream.foldLeft +0 (Int.+) 7 | -------------------------------------------------------------------------------- /unison-src/errors/unsound-cont.u: -------------------------------------------------------------------------------- 1 | 2 | structural ability Ask a where 3 | ask : {Ask a} a 4 | 5 | supply : Text -> Request (Ask Text) a -> a 6 | supply t = cases 7 | {a} -> a 8 | -- `k` should be of type `Text -> Request Ask a`, 9 | -- so calling it with `()` here should be a type error 10 | {Ask.ask -> k} -> handle k () with supply t 11 | 12 | () 13 | -------------------------------------------------------------------------------- /unison-src/parser-tests/empty-match-list.message.txt: -------------------------------------------------------------------------------- 1 | empty-match-list.u:3:5: 2 | unexpected = 3 | 3 | bar = 3 4 | -------------------------------------------------------------------------------- /unison-src/parser-tests/empty-match-list.u: -------------------------------------------------------------------------------- 1 | foo n = match n with 2 | 3 | bar = 3 4 | -------------------------------------------------------------------------------- /unison-src/parser-tests/if-without-condition.message.txt: -------------------------------------------------------------------------------- 1 | if-without-condition.u:1:10: 2 | unexpected then 3 | 1 | foo = if then 4 else 8 4 | -------------------------------------------------------------------------------- /unison-src/parser-tests/if-without-condition.u: -------------------------------------------------------------------------------- 1 | foo = if then 4 else 8 2 | -------------------------------------------------------------------------------- /unison-src/tests/324.u: -------------------------------------------------------------------------------- 1 | foo a b = 2 | if Text.eq a "" then 3 | match Text.size b with 4 | 1 -> false 5 | _ -> true 6 | else 7 | true 8 | -------------------------------------------------------------------------------- /unison-src/tests/344.uu: -------------------------------------------------------------------------------- 1 | structural ability Either a b where 2 | left : a -> {Either a b} () 3 | right : b -> {Either a b} () 4 | 5 | structural type Either a b = Left a | Right b 6 | -------------------------------------------------------------------------------- /unison-src/tests/514.u: -------------------------------------------------------------------------------- 1 | 2 | -- all these can be added 3 | 4 | idNat : Nat -> Nat 5 | idNat x = x 6 | 7 | idInt : Int -> Int 8 | idInt x = x 9 | 10 | idPoly x = x 11 | 12 | idPoly2 : x -> x 13 | idPoly2 y = y 14 | -------------------------------------------------------------------------------- /unison-src/tests/595.u: -------------------------------------------------------------------------------- 1 | 2 | structural type Any = Any (∀ r . (∀ a . a -> r) -> r) 3 | 4 | -- also typechecks as expected 5 | any : a -> Any 6 | any a = Any.Any (k -> k a) 7 | 8 | --- 9 | This typechecks fine, as expected, but try to `update` to codebase, get: 10 | 11 | unison: unknown var in environment: "r" environment = [Right User "a"] 12 | CallStack (from HasCallStack): 13 | error, called at src/Unison/ABT.hs:632:19 in unison-parser-typechecker-0.1-JxZSVhIPWTr4SazQ0mw03q:Unison.ABT 14 | -------------------------------------------------------------------------------- /unison-src/tests/868.u: -------------------------------------------------------------------------------- 1 | structural type Choice = First | Second 2 | structural type Wrapper = Wrapper Choice 3 | 4 | broken = match Wrapper.Wrapper Choice.Second with 5 | Wrapper.Wrapper Choice.First -> true 6 | _ -> false 7 | 8 | > broken 9 | -------------------------------------------------------------------------------- /unison-src/tests/868.ur: -------------------------------------------------------------------------------- 1 | false 2 | -------------------------------------------------------------------------------- /unison-src/tests/a-tale-of-two-optionals.u: -------------------------------------------------------------------------------- 1 | structural type Optional a = None | Some a 2 | 3 | Optional.isEmpty : Optional a -> Boolean 4 | Optional.isEmpty = cases 5 | Optional.None -> true 6 | Optional.Some _ -> false 7 | 8 | increment x = x + 1 9 | 10 | (|>) : forall a b . a -> (a -> b) -> b 11 | a |> f = f a 12 | 13 | > Optional.Some 4 14 | -------------------------------------------------------------------------------- /unison-src/tests/ability-keyword.u: -------------------------------------------------------------------------------- 1 | structural ability Foo where 2 | foo : {Foo} Text 3 | 4 | x = 'let 5 | y = Foo.foo 6 | () -------------------------------------------------------------------------------- /unison-src/tests/abort.u: -------------------------------------------------------------------------------- 1 | --Abort 2 | structural ability Abort where 3 | Abort : forall a . () -> {Abort} a 4 | eff : forall a b . (a -> b) -> b -> Request Abort a -> b 5 | eff f z = cases 6 | { Abort.Abort _ -> k } -> z 7 | { a } -> f a 8 | -- heff : Nat 9 | heff = handle Abort.Abort () with eff (x -> x Nat.+ 2) 1 10 | hudy : Nat 11 | hudy = handle 42 with eff (x -> x Nat.+ 2) 1 12 | bork : () -> {Abort} Nat 13 | bork = u -> 1 Nat.+ (Abort.Abort ()) 14 | -------------------------------------------------------------------------------- /unison-src/tests/ask-inferred.u: -------------------------------------------------------------------------------- 1 | --Ask inferred 2 | 3 | structural ability Ask a where 4 | ask : {Ask a} a 5 | 6 | structural ability AskU where 7 | ask : {AskU} Nat 8 | 9 | use Nat + 10 | 11 | structural ability AskT where 12 | ask : {AskT} Text 13 | 14 | x = '(Ask.ask + 1) 15 | x2 = '(Ask.ask + AskU.ask) 16 | 17 | x3 = '(Ask.ask + AskU.ask + size AskT.ask) 18 | 19 | y : '{Ask Nat} Nat 20 | y = '(!x) 21 | 22 | y2 : '{Ask Nat, AskU} Nat 23 | y2 = x2 24 | -------------------------------------------------------------------------------- /unison-src/tests/boolean-ops-in-sequence.u: -------------------------------------------------------------------------------- 1 | test = true || false && true 2 | -------------------------------------------------------------------------------- /unison-src/tests/builtin-arity-0-evaluation.u: -------------------------------------------------------------------------------- 1 | use Universal == 2 | 3 | > Text.empty == "" 4 | -------------------------------------------------------------------------------- /unison-src/tests/builtin-arity-0-evaluation.ur: -------------------------------------------------------------------------------- 1 | true 2 | -------------------------------------------------------------------------------- /unison-src/tests/caseguard.u: -------------------------------------------------------------------------------- 1 | -- Used to fail on the guard 2 | -- 3 | -- typechecker.tests/caseguard.u FAILURE I'm not sure what x means at line 3, columns 9-10 4 | -- 5 | -- 3 | x | x == "woot" -> false 6 | -- 7 | -- Whatever it is, it has a type that conforms to Text. 8 | 9 | use Universal == 10 | 11 | f = cases 12 | x | x == "woot" -> false 13 | y | otherwise -> true 14 | 15 | -- > f "woot" 16 | -------------------------------------------------------------------------------- /unison-src/tests/cce.ur: -------------------------------------------------------------------------------- 1 | [1, 1, 1, 1, 2, 2, 2, 3, 3, 23, 34, 9182] 2 | -------------------------------------------------------------------------------- /unison-src/tests/compose-inference.u: -------------------------------------------------------------------------------- 1 | 2 | compose f g = x -> f (g x) 3 | 4 | > compose 5 | -------------------------------------------------------------------------------- /unison-src/tests/data-references-builtins.u: -------------------------------------------------------------------------------- 1 | --data references builtins 2 | structural type StringOrInt = S Text | I Nat 3 | > [StringOrInt.S "YO", StringOrInt.I 1] 4 | 5 | -------------------------------------------------------------------------------- /unison-src/tests/delay_parse.u: -------------------------------------------------------------------------------- 1 | structural ability T where 2 | foo : {T} () 3 | 4 | -- parses fine 5 | a : () -> {T} () 6 | a x = () 7 | 8 | -- parses fine 9 | b : () -> '() 10 | b = x -> (y -> ()) 11 | 12 | -- parse error 13 | c : () -> {T} '() 14 | c = x -> (y -> ()) 15 | 16 | -- parses fine with extra parentheses 17 | d : () -> {T} ('()) 18 | d = x -> (y -> ()) 19 | 20 | 21 | -------------------------------------------------------------------------------- /unison-src/tests/effect-instantiation.u: -------------------------------------------------------------------------------- 1 | 2 | blah : a -> a -> a 3 | blah a a2 = a2 4 | 5 | structural ability Foo where 6 | foo : {Foo} Text 7 | 8 | -- previously this didn't work as first argument was pure 9 | -- and second argument was impure 10 | > blah '("hello!") 'Foo.foo 11 | -------------------------------------------------------------------------------- /unison-src/tests/effect-instantiation2.u: -------------------------------------------------------------------------------- 1 | 2 | woot : a -> a -> a 3 | woot a a2 = a 4 | 5 | structural ability Hi where 6 | hi : Float ->{Hi} Int 7 | 8 | > woot Float.floor Hi.hi 9 | -------------------------------------------------------------------------------- /unison-src/tests/effect1.u: -------------------------------------------------------------------------------- 1 | 2 | eff : forall a b . (a -> b) -> b -> Request Abort a -> b 3 | eff f z = cases 4 | { Abort.Abort _ -> k } -> z 5 | { a } -> f a 6 | 7 | structural ability Abort where 8 | Abort : forall a . () -> {Abort} a 9 | -------------------------------------------------------------------------------- /unison-src/tests/empty-above-the-fold.u: -------------------------------------------------------------------------------- 1 | -- Empty files and all-comment files parse fine, so this one should too. 2 | ---- Anything below this line is ignored by Unison. 3 | 4 | -- /Users/arya/unison/unison-src/tests/empty-above-the-fold.u:1:1: 5 | -- unexpected end of input 6 | -- expecting ability, ability, or use 7 | -------------------------------------------------------------------------------- /unison-src/tests/fib4.ur: -------------------------------------------------------------------------------- 1 | 2249999 2 | -------------------------------------------------------------------------------- /unison-src/tests/fix1640.u: -------------------------------------------------------------------------------- 1 | 2 | unique type Color = Red | Black 3 | unique type RBTree a = Leaf | Tree Color (RBTree a) a (RBTree a) 4 | 5 | -- interesting, this typechecks fine 6 | isRed = cases 7 | Color.Red -> true 8 | Color.Black -> false 9 | 10 | -- as does this 11 | RBTree.isRed1 = cases 12 | RBTree.Tree _ _ _ _ -> true 13 | _ -> false 14 | 15 | -- but this did not (before this fix) 16 | RBTree.isRed = cases 17 | RBTree.Tree Color.Red _ _ _ -> true 18 | _ -> false 19 | 20 | -- In fixing this bug, I noticed that the parser would previously reject 21 | -- this perfectly cromulent pattern match, so I fixed that too. 22 | thisIsTotallyLegit = cases 23 | [RBTree.Tree _ _ _ _] -> true 24 | _ -> false 25 | 26 | -------------------------------------------------------------------------------- /unison-src/tests/fix1695.u: -------------------------------------------------------------------------------- 1 | 2 | structural ability G a where 3 | get : a 4 | 5 | f x y = 6 | g = G.get 7 | g x 8 | -------------------------------------------------------------------------------- /unison-src/tests/fix1779.u: -------------------------------------------------------------------------------- 1 | unique ability S a where 2 | s : a 3 | 4 | unique type R g = R ('{g} ()) 5 | 6 | run : '{S (R g), g} () 7 | run _ = todo () 8 | 9 | run' : '{S (R {})} () 10 | run' = run 11 | -------------------------------------------------------------------------------- /unison-src/tests/fix528.u: -------------------------------------------------------------------------------- 1 | 2 | (|>) : a -> (a -> b) -> b 3 | a |> f = f a 4 | 5 | ex1 = "bob" |> (Text.++) "hi, " 6 | 7 | structural type Woot = Woot Text Int Nat 8 | 9 | ex2 = match 0 |> Woot "Zonk" +10 with 10 | Woot.Woot _ i _ -> i 11 | 12 | > (ex1, ex2) 13 | -------------------------------------------------------------------------------- /unison-src/tests/fix528.ur: -------------------------------------------------------------------------------- 1 | ("hi, bob", +10) 2 | -------------------------------------------------------------------------------- /unison-src/tests/fix5507.md: -------------------------------------------------------------------------------- 1 | ```ucm :hide 2 | scratch/main> builtins.merge lib.builtin 3 | ``` 4 | 5 | ```unison :hide 6 | Nat.toBytesLittleEndian : Nat -> Bytes 7 | Nat.toBytesLittleEndian = encodeNat64le 8 | ``` 9 | 10 | ```ucm :hide 11 | scratch/main> add 12 | ``` 13 | 14 | `Nat.toBytesLittleEndian` gets inlined, but it should still be found in the code cache when this is compiled and re-loaded. 15 | 16 | ```unison :hide 17 | main : '{IO} () 18 | main = do 19 | _ = Nat.toBytesLittleEndian 3 20 | match Code.lookup (termLink Nat.toBytesLittleEndian) with 21 | Some _code -> () 22 | None -> bug "code cache was empty" 23 | ``` 24 | 25 | ```ucm :hide 26 | scratch/main> add 27 | scratch/main> compile main fix5507 28 | ``` 29 | -------------------------------------------------------------------------------- /unison-src/tests/fix5507.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | set -ex 3 | 4 | # the first arg is the path to the unison executable 5 | if [ -z "$1" ]; then 6 | echo "Usage: $0 " 7 | exit 1 8 | fi 9 | 10 | # call unison with all its args quoted 11 | "$@" transcript unison-src/tests/fix5507.md \ 12 | && "$@" run.compiled fix5507.uc 13 | -------------------------------------------------------------------------------- /unison-src/tests/fix739.u: -------------------------------------------------------------------------------- 1 | structural type MonoidRec a = { 2 | combine : a -> a -> a, 3 | empty : a 4 | } 5 | -------------------------------------------------------------------------------- /unison-src/tests/force.u: -------------------------------------------------------------------------------- 1 | structural ability Woot where woot : {Woot} Text 2 | 3 | force : '{e} a ->{e} a 4 | force a = !a 5 | 6 | ex : '{Woot} Text 7 | ex = '(force 'Woot.woot) 8 | 9 | > ex 10 | -------------------------------------------------------------------------------- /unison-src/tests/guard-boolean-operators.u: -------------------------------------------------------------------------------- 1 | structural type Foo = Foo Boolean Boolean 2 | 3 | f : Foo -> Boolean 4 | f = cases 5 | Foo.Foo a b | a || b -> true 6 | _ -> false 7 | 8 | g : Foo -> Boolean 9 | g = cases 10 | Foo.Foo a b | a && b -> true 11 | _ -> false 12 | -------------------------------------------------------------------------------- /unison-src/tests/id.u: -------------------------------------------------------------------------------- 1 | id : a -> a 2 | id x = x 3 | 4 | > id -------------------------------------------------------------------------------- /unison-src/tests/if.u: -------------------------------------------------------------------------------- 1 | foo = if true then true else false 2 | > foo -------------------------------------------------------------------------------- /unison-src/tests/imports.u: -------------------------------------------------------------------------------- 1 | -- This brings `None` into scope unqualified 2 | use Optional None 3 | 4 | -- '.' is optional, this brings `None` and `Some` into 5 | -- scope unqualified 6 | use Optional None Some 7 | 8 | -- Can import operators this way also 9 | -- no need to put them in parens 10 | use Nat + 11 | 12 | -- Later imports shadow earlier ones 13 | use Nat - * / 14 | use Nat drop * 15 | use Nat drop 16 | -- use Int + -- this would cause type error below! 17 | 18 | > match Some (100 + 200 / 3 * 2) with 19 | Optional.None -> 19 20 | Some _ -> 20 21 | -------------------------------------------------------------------------------- /unison-src/tests/imports2.u: -------------------------------------------------------------------------------- 1 | -- This gives the error: 2 | -- I'm not sure what Optional.orElse means at Line 12 3 | -- which is weird because it means Optional.orElse, which is defined here. 4 | 5 | use Optional Some None orElse 6 | 7 | Optional.orElse a b = 8 | match a with 9 | None -> b 10 | a -> a 11 | 12 | > orElse 13 | -------------------------------------------------------------------------------- /unison-src/tests/inner-lambda1.u: -------------------------------------------------------------------------------- 1 | use Nat drop 2 | use Optional None Some 3 | 4 | search : (Nat -> Int) -> Nat -> Nat -> Optional Nat 5 | search hit bot top = 6 | -- go : Nat -> Nat -> Optional Nat 7 | go bot top = 8 | if bot >= top then None 9 | else 10 | mid = (bot + top) / 2 11 | match hit mid with 12 | +0 -> Some mid 13 | -1 -> go bot (drop mid 1) 14 | +1 -> go (mid + 1) top 15 | _ -> bug "unexpected" 16 | go bot top 17 | -------------------------------------------------------------------------------- /unison-src/tests/inner-lambda2.u: -------------------------------------------------------------------------------- 1 | 2 | use Nat drop 3 | use Optional None Some 4 | 5 | search : (Nat -> Int) -> Nat -> Nat -> Optional Nat 6 | search hit bot top = 7 | go : Nat -> Nat -> Optional Nat 8 | go bot top = 9 | if bot >= top then None 10 | else 11 | mid = (bot + top) / 2 12 | match hit mid with 13 | +0 -> Some mid 14 | -1 -> go bot (drop mid 1) 15 | +1 -> go (mid + 1) top 16 | _ -> bug "unexpected" 17 | go bot top 18 | -------------------------------------------------------------------------------- /unison-src/tests/io-state2.u: -------------------------------------------------------------------------------- 1 | --IO/State2 ability 2 | structural ability IO where 3 | launchMissiles : {IO} () 4 | 5 | foo : Int -> {IO} Int 6 | foo unit = 7 | incBy : Int -> {IO, State Int} Int 8 | incBy i = 9 | IO.launchMissiles -- OK, since declared by `incBy` signature 10 | y = State.get 11 | State.put (y Int.+ i) 12 | +42 13 | +43 14 | 15 | structural type Optional a = 16 | Some a | None 17 | 18 | structural ability State se2 where 19 | put : ∀ se . se -> {State se} () 20 | get : ∀ se . {State se} se 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /unison-src/tests/io-state3.u: -------------------------------------------------------------------------------- 1 | --IO3 ability 2 | structural ability IO where 3 | launchMissiles : () -> {IO} () 4 | -- binding IS guarded, so its body can access whatever abilities 5 | -- are declared by the type of the binding 6 | -- ambient abilities (which will be empty) 7 | ex1 : () -> {IO} () 8 | ex1 unit = IO.launchMissiles() 9 | 10 | 11 | -------------------------------------------------------------------------------- /unison-src/tests/keyword-parse.u: -------------------------------------------------------------------------------- 1 | f x = x 2 | 3 | > (f false) && false 4 | -- and false false 5 | -------------------------------------------------------------------------------- /unison-src/tests/lambda-closing-over-effectful-fn.u: -------------------------------------------------------------------------------- 1 | use Optional None Some 2 | 3 | unfold : s -> (s ->{z} Optional (a, s)) ->{z} [a] 4 | unfold s f = 5 | go s acc = match f s with 6 | None -> acc 7 | Some (hd, s) -> go s (List.snoc acc hd) 8 | go s [] 9 | 10 | > unfold 0 (n -> if n < 5 then Some (n, n + 1) else None) 11 | -------------------------------------------------------------------------------- /unison-src/tests/lambda-closing-over-effectful-fn.ur: -------------------------------------------------------------------------------- 1 | [0,1,2,3,4] 2 | -------------------------------------------------------------------------------- /unison-src/tests/links.u: -------------------------------------------------------------------------------- 1 | 2 | 3 | natLink : Link.Type 4 | natLink = typeLink Nat 5 | 6 | takeLink : Link.Term 7 | takeLink = termLink List.take 8 | 9 | dropLink : Link.Term 10 | dropLink = termLink List.drop 11 | 12 | > (takeLink == dropLink, natLink == typeLink Nat) 13 | 14 | -------------------------------------------------------------------------------- /unison-src/tests/links.ur: -------------------------------------------------------------------------------- 1 | (false, true) 2 | -------------------------------------------------------------------------------- /unison-src/tests/methodical/abilities.ur: -------------------------------------------------------------------------------- 1 | (42, 53, 43, 5, 6) 2 | -------------------------------------------------------------------------------- /unison-src/tests/methodical/apply-constructor.u: -------------------------------------------------------------------------------- 1 | 2 | -- Now check exact and underapply cases for constructors 3 | -- (overapply of a constructor is always a type error) 4 | 5 | structural type Woot = Woot Nat Nat Nat Nat 6 | 7 | toSeq : Woot -> [Nat] 8 | toSeq = cases 9 | Woot a b c d -> [a,b,c,d] 10 | 11 | use Woot Woot 12 | 13 | exactt = Woot 1 2 3 4 14 | 15 | underapply0t = 16 | p1 = 1 17 | f = Woot p1 18 | f 2 3 4 19 | 20 | underapply1t = 21 | p2 = 2 22 | f = Woot 1 p2 23 | f 3 4 24 | 25 | underapply2t = 26 | f = Woot 1 2 3 27 | f 4 28 | 29 | > (toSeq exactt, toSeq underapply0t, toSeq underapply1t, toSeq underapply2t) 30 | -------------------------------------------------------------------------------- /unison-src/tests/methodical/apply-constructor.ur: -------------------------------------------------------------------------------- 1 | ([1,2,3,4], [1,2,3,4], [1,2,3,4], [1,2,3,4]) 2 | -------------------------------------------------------------------------------- /unison-src/tests/methodical/apply.ur: -------------------------------------------------------------------------------- 1 | ([1,2,3,4], [1,2,3,4], [1,2,3,4], [1,2,3,4], [1,2,3,4], [1,2,3,4], [1,2,3,4], 99) 2 | -------------------------------------------------------------------------------- /unison-src/tests/methodical/builtin-nat-to-float.u: -------------------------------------------------------------------------------- 1 | > Nat.toFloat 4 2 | -------------------------------------------------------------------------------- /unison-src/tests/methodical/builtin-nat-to-float.ur: -------------------------------------------------------------------------------- 1 | 4.0 2 | -------------------------------------------------------------------------------- /unison-src/tests/methodical/builtins.u: -------------------------------------------------------------------------------- 1 | use Optional Some None 2 | 3 | > natTextRoundTrip = 4 | Nat.fromText (Nat.toText 123) Universal.== Some 123 5 | 6 | > intTextRoundTripPos = 7 | Int.fromText (Int.toText +123) Universal.== Some +123 8 | 9 | > intTextRoundTripNeg = 10 | Int.fromText (Int.toText -123) Universal.== Some -123 11 | 12 | > intFloatRoundTrip = 13 | Float.round (Int.toFloat +123) Universal.== +123 14 | 15 | -------------------------------------------------------------------------------- /unison-src/tests/methodical/cycle-minimize.u: -------------------------------------------------------------------------------- 1 | 2 | structural ability SpaceAttack where 3 | launchMissiles : Text -> () 4 | 5 | -- should typecheck fine, as the `launchMissiles "saturn"` 6 | -- gets moved out of the `ping` / `pong` cycle 7 | ex x = 8 | ping x = pong (x + 1) 9 | launchMissiles "saturn" 10 | pong x = ping (Nat.drop x 1) 11 | launchMissiles "neptune" 12 | -------------------------------------------------------------------------------- /unison-src/tests/methodical/dots.ur: -------------------------------------------------------------------------------- 1 | (42,42) 2 | -------------------------------------------------------------------------------- /unison-src/tests/methodical/empty.u: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unisonweb/unison/07a855e4674837f6506957055fc58d901e922715/unison-src/tests/methodical/empty.u -------------------------------------------------------------------------------- /unison-src/tests/methodical/empty2.u: -------------------------------------------------------------------------------- 1 | -- This file is empty but has a comment 2 | -------------------------------------------------------------------------------- /unison-src/tests/methodical/empty3.u: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | This file is empty but has some stuff below the fold 4 | -------------------------------------------------------------------------------- /unison-src/tests/methodical/exponential.u: -------------------------------------------------------------------------------- 1 | use Float exp log logBase 2 | 3 | > (exp 0.0, 4 | log (exp 1.0), 5 | logBase 10.0 100.0) -------------------------------------------------------------------------------- /unison-src/tests/methodical/exponential.ur: -------------------------------------------------------------------------------- 1 | (1.0, 2 | 1.0, 3 | 2.0) -------------------------------------------------------------------------------- /unison-src/tests/methodical/float.u: -------------------------------------------------------------------------------- 1 | use Float abs max min toText fromText eq 2 | use Optional Some None 3 | 4 | withDefault : Optional a -> a -> a 5 | withDefault opt d = match opt with 6 | Some x -> x 7 | None -> d 8 | 9 | > (abs 1.1, 10 | abs -1.1, 11 | max 1.1 1.5, 12 | min 1.1 1.5, 13 | toText 1.1, 14 | withDefault (fromText "1.5") -1.0, 15 | withDefault (fromText "Hello world!") -1.0, 16 | eq 0.0 0.0, 17 | eq 0.0 2.0) 18 | -------------------------------------------------------------------------------- /unison-src/tests/methodical/float.ur: -------------------------------------------------------------------------------- 1 | (1.1, 2 | 1.1, 3 | 1.5, 4 | 1.1, 5 | "1.1", 6 | 1.5, 7 | -1.0, 8 | true, 9 | false) 10 | -------------------------------------------------------------------------------- /unison-src/tests/methodical/hyperbolic.u: -------------------------------------------------------------------------------- 1 | use Float acosh asinh atanh cosh sinh tanh 2 | 3 | > (acosh 1.0, 4 | asinh 0.0, 5 | atanh 0.0, 6 | cosh 0.0, 7 | sinh 0.0, 8 | tanh 0.0) -------------------------------------------------------------------------------- /unison-src/tests/methodical/hyperbolic.ur: -------------------------------------------------------------------------------- 1 | (0.0, 2 | 0.0, 3 | 0.0, 4 | 1.0, 5 | 0.0, 6 | 0.0) -------------------------------------------------------------------------------- /unison-src/tests/methodical/int.u: -------------------------------------------------------------------------------- 1 | use Int increment isEven isOdd signum negate mod pow shiftLeft shiftRight truncate0 toText fromText toFloat leadingZeros trailingZeros and or xor complement 2 | 3 | withDefault : Optional a -> a -> a 4 | withDefault opt d = match opt with 5 | Some x -> x 6 | None -> d 7 | 8 | > (increment +3, 9 | isEven +3, 10 | isOdd +3, 11 | signum +3, 12 | negate +3, 13 | mod +10 +3, 14 | pow +10 3, 15 | shiftLeft +7 2, 16 | shiftRight +7 2, 17 | truncate0 +3, 18 | truncate0 -3, 19 | withDefault (fromText "3x") -1, 20 | withDefault (fromText "+3") -1, 21 | leadingZeros +0, 22 | leadingZeros +1, 23 | leadingZeros +8, 24 | toFloat +3) -------------------------------------------------------------------------------- /unison-src/tests/methodical/int.ur: -------------------------------------------------------------------------------- 1 | (+4, 2 | false, 3 | true, 4 | +1, 5 | -3, 6 | +1, 7 | +1000, 8 | +28, 9 | +1, 10 | 3, 11 | 0, 12 | -1, 13 | +3, 14 | 64, 15 | 63, 16 | 60, 17 | 3.0) 18 | -------------------------------------------------------------------------------- /unison-src/tests/methodical/let.u: -------------------------------------------------------------------------------- 1 | 2 | -- LET 3 | c0 = 4 | a = 1000 5 | b = 100 6 | c = 10 7 | d = 1 8 | [a + b + c + d, b + c + d, c + d, d] 9 | 10 | -- Make sure we can push values onto the stack and reference them as expected 11 | > c0 12 | 13 | -------------------------------------------------------------------------------- /unison-src/tests/methodical/let.ur: -------------------------------------------------------------------------------- 1 | [1111,111,11,1] 2 | -------------------------------------------------------------------------------- /unison-src/tests/methodical/literals.u: -------------------------------------------------------------------------------- 1 | 2 | -- LITERALS 3 | ln = 10 4 | li = +10 5 | lf = 10.0 6 | lt = "text" 7 | lc = ?ひ 8 | lb = true 9 | sn = [1,2,3,4,5,6,ln] 10 | 11 | -- Allow redundant commas in lists #1841 12 | s = [,,,,,,] 13 | stn = [,,,(1,2),,,(3,4),(5,6),,,,] 14 | sc = 15 | [ 16 | , 17 | -- ?d 18 | , 19 | ?* 20 | , 21 | 22 | ?1 23 | , 24 | , ?§, ?°, 25 | ?;, 26 | , 27 | , , 28 | ] 29 | 30 | -- Make sure we can compile all literals 31 | > (ln, li, lf, lt, lc, lb, sn, s, stn, sc) 32 | -------------------------------------------------------------------------------- /unison-src/tests/methodical/literals.ur: -------------------------------------------------------------------------------- 1 | (10, 2 | +10, 3 | 10.0, 4 | "text", 5 | ?ひ, 6 | true, 7 | [1,2,3,4,5,6,10], 8 | [], 9 | [(1,2),(3,4),(5,6)], 10 | [?*,?1,?§,?°,?;]) 11 | -------------------------------------------------------------------------------- /unison-src/tests/methodical/loop.u: -------------------------------------------------------------------------------- 1 | 2 | use Universal == 3 | 4 | loop acc n = 5 | if n == 0 then acc 6 | else loop (acc + n) (drop n 1) 7 | 8 | > loop 0 10000 9 | -------------------------------------------------------------------------------- /unison-src/tests/methodical/nat.ur: -------------------------------------------------------------------------------- 1 | (3, 2 | 1, 3 | 4, 4 | false, 5 | true, 6 | 1, 7 | 1000, 8 | 28, 9 | 1, 10 | 64, 11 | 63, 12 | 60, 13 | 64, 14 | 0, 15 | 3, 16 | 2, 17 | 15, 18 | 9, 19 | 18446744073709551615, 20 | +1, 21 | 3.0, 22 | +3, 23 | "3") 24 | -------------------------------------------------------------------------------- /unison-src/tests/methodical/nesting.u: -------------------------------------------------------------------------------- 1 | 2 | h0 x s = handle !x with cases 3 | { _ } -> s 4 | 5 | h1 x s = cases 6 | { _ } -> handle !x with cases 7 | { _ } -> s 8 | 9 | > (h0 (_ -> 5) 6, handle 8 with h1 (_ -> 5) 7) 10 | -------------------------------------------------------------------------------- /unison-src/tests/methodical/overapply-ability.ur: -------------------------------------------------------------------------------- 1 | (18, 18, [3], [3, 3], [3, 2, 1, 0], [1,2,3,4], [1,2,3,4,5], [1,2,3,4,5,6], [1,2,3,4,5,6]) 2 | -------------------------------------------------------------------------------- /unison-src/tests/methodical/parens.u: -------------------------------------------------------------------------------- 1 | ex1 = '(let 2 | use List ++ 3 | [1] ++ [3]) 4 | 5 | ex2 = '(let 6 | use List ++ 7 | [1] ++ [3] 8 | ) 9 | 10 | ex3 = '(let 11 | use List ++ 12 | [1] ++ [3] 13 | ) 14 | 15 | ex4 = '( 16 | let 17 | use List ++ 18 | _ = [1] ++ [3] 19 | [4] 20 | ) 21 | 22 | ex5 = '( 23 | let 24 | use List ++ 25 | [1] ++ [3] 26 | ) 27 | 28 | > (ex1, ex2, ex3, ex4, ex5) 29 | -------------------------------------------------------------------------------- /unison-src/tests/methodical/pattern-matching.ur: -------------------------------------------------------------------------------- 1 | (((2,3), 0, 1, (2,3)), 2 | (0, 1, "hi"), 3 | (3, 2), 4 | (0, 1, 2), 5 | (0, 1, 2), 6 | (3, 3), 7 | (0, 20), 8 | 0, 9 | 1, 10 | 1, 11 | 0, 12 | -1, 13 | +1, 14 | +0, 15 | ([1,2,3], 1, [2,3]), 16 | 1, 17 | 2) 18 | -------------------------------------------------------------------------------- /unison-src/tests/methodical/power.u: -------------------------------------------------------------------------------- 1 | use Float pow sqrt 2 | 3 | > (pow 10.0 2.0, 4 | sqrt 4.0) -------------------------------------------------------------------------------- /unison-src/tests/methodical/power.ur: -------------------------------------------------------------------------------- 1 | (100.0, 2 | 2.0 -------------------------------------------------------------------------------- /unison-src/tests/methodical/rank2.u: -------------------------------------------------------------------------------- 1 | 2 | -- This should typecheck, since `∀ a . a -> a` can be passed in place of 3 | -- a `Nat -> Nat`. Verifies that subtyping of `->` is contravariant in the 4 | -- input types. 5 | rank2b : (∀ a . a -> a) -> Nat 6 | rank2b = 7 | inner : (Nat -> Nat) -> Nat 8 | inner f = 42 9 | inner 10 | -------------------------------------------------------------------------------- /unison-src/tests/methodical/rounding.u: -------------------------------------------------------------------------------- 1 | use Float ceiling floor round truncate 2 | 3 | > (ceiling 1.1, 4 | floor 1.7, 5 | round 1.1, 6 | round 1.7, 7 | truncate 1.1, 8 | truncate -1.1) -------------------------------------------------------------------------------- /unison-src/tests/methodical/rounding.ur: -------------------------------------------------------------------------------- 1 | (+2, 2 | +1, 3 | +1, 4 | +2, 5 | +1, 6 | -1) 7 | -------------------------------------------------------------------------------- /unison-src/tests/methodical/semis.u: -------------------------------------------------------------------------------- 1 | 2 | -- explicit semicolons allowed inside the block parser 3 | -- no need for a space either before or after 4 | x = 5 | _ = 0; 6 | 1 7 | y = 8 | _ = 0; 9 | 1 10 | z = 11 | _ = x; 12 | y 13 | (**) = 14 | _ = x ; 15 | y 16 | a = 17 | a1 = (**); 18 | a2 = (**); 19 | z 20 | p = _ = 1;-- comments are okay after a semi 21 | 1 -- and you can put a semi between lines, 22 | -- even if a virtual semi would have been emitted 23 | 24 | > (x,y,z,(**),a,p) 25 | -------------------------------------------------------------------------------- /unison-src/tests/methodical/semis.ur: -------------------------------------------------------------------------------- 1 | (1,1,1,1,1,1) 2 | -------------------------------------------------------------------------------- /unison-src/tests/methodical/trig.u: -------------------------------------------------------------------------------- 1 | use Float acos asin atan atan2 cos sin tan 2 | 3 | > (cos 0.0, 4 | sin 0.0, 5 | tan 0.0, 6 | acos (cos 0.0), 7 | asin (sin 0.0), 8 | atan (tan 0.0), 9 | atan2 0.0 0.0) 10 | -------------------------------------------------------------------------------- /unison-src/tests/methodical/trig.ur: -------------------------------------------------------------------------------- 1 | (1.0, 2 | 0.0, 3 | 0.0, 4 | 0.0, 5 | 0.0, 6 | 0.0, 7 | 0.0) -------------------------------------------------------------------------------- /unison-src/tests/methodical/universals.u: -------------------------------------------------------------------------------- 1 | use Universal == < > <= >= compare 2 | 3 | > (compare [1,2,3] [1,2,3], 4 | compare [1,2,3] [1], 5 | compare [1] [1,2,3], 6 | compare ?a ?b, 7 | ("hi", "there") == ("hi", "there"), 8 | 1 < 1, 9 | 1 < 2, 10 | 2 < 1, 11 | 1 <= 2, 12 | 1 <= 1, 13 | 2 <= 1, 14 | 0 > 1, 15 | 1 > 0, 16 | 0 > 0, 17 | 0 >= 0, 18 | 1 >= 0, 19 | 0 >= 1, 20 | -1.0 < -2.0, 21 | 0x8000000000000000 < 0, 22 | -0.0 < 0.0, 23 | -1.0 < 2.0, 24 | 1.0 < -2.0) 25 | 26 | -------------------------------------------------------------------------------- /unison-src/tests/methodical/universals.ur: -------------------------------------------------------------------------------- 1 | (+0, 2 | +1, 3 | -1, 4 | -1, 5 | true, 6 | false, 7 | true, 8 | false, 9 | true, 10 | true, 11 | false, 12 | false, 13 | true, 14 | false, 15 | true, 16 | true, 17 | false, 18 | false, 19 | false, 20 | false, 21 | true, 22 | false) 23 | -------------------------------------------------------------------------------- /unison-src/tests/methodical/wildcardimports.u: -------------------------------------------------------------------------------- 1 | 2 | use Text 3 | 4 | -- note: this `drop` call would be ambiguous normally (`Bytes.drop`, `Nat.drop`...) 5 | -- but the wildcard import of `Text` brings it into scope 6 | foo x = drop 10 x 7 | -------------------------------------------------------------------------------- /unison-src/tests/multiple-effects.u: -------------------------------------------------------------------------------- 1 | structural ability State s where 2 | get : {State s} s 3 | set : s -> {State s} () 4 | 5 | structural ability Console where 6 | read : {Console} (Optional Text) 7 | write : Text -> {Console} () 8 | 9 | Console.state : s -> Request (State s) a -> a 10 | Console.state s = cases 11 | {State.get -> k} -> handle k s with Console.state s 12 | {State.set s' -> k} -> handle k () with Console.state s' 13 | {a} -> a 14 | 15 | multiHandler : s -> [w] -> Nat -> Request {State s, Console} a -> () 16 | multiHandler _ _ _ _ = () 17 | -------------------------------------------------------------------------------- /unison-src/tests/one-liners.uu: -------------------------------------------------------------------------------- 1 | (if true then 1 else 2) : Nat 2 | (if true then (x -> x) else (x -> x) : forall a . a -> a) 3 | -------------------------------------------------------------------------------- /unison-src/tests/parenthesized-blocks.u: -------------------------------------------------------------------------------- 1 | 2 | x = (if true then 1 else 0) + 1 3 | y = (match 1 with _ -> 1) + 1 4 | 5 | > (x, y) 6 | -------------------------------------------------------------------------------- /unison-src/tests/parenthesized-blocks.ur: -------------------------------------------------------------------------------- 1 | (2, 2) 2 | -------------------------------------------------------------------------------- /unison-src/tests/pattern-match-seq.ur: -------------------------------------------------------------------------------- 1 | ( 3, 2 | 15, 3 | 8, 4 | 11, 5 | 5, 6 | [], 7 | [1], 8 | [], 9 | [], 10 | [(1, 2)], 11 | [], 12 | [], 13 | [(2, 3)], 14 | [], 15 | [[]], 16 | [[2, 3, 4, 5]], 17 | [], 18 | [], 19 | [(2, [3, 4, 5])], 20 | ([1, 2, 3, 4], [5, 6, 7]) ) 21 | -------------------------------------------------------------------------------- /unison-src/tests/pattern-matching.ur: -------------------------------------------------------------------------------- 1 | ("byebye", "byebye", 1, 10, 0) 2 | -------------------------------------------------------------------------------- /unison-src/tests/pattern-matching2.u: -------------------------------------------------------------------------------- 1 | structural type Foo0 = Foo0 2 | structural type Foo1 a = Foo1 a 3 | structural type Foo2 a b = Foo2 a b 4 | structural type Foo3 a b c = Foo3 a b c 5 | 6 | use Foo0 Foo0 7 | use Foo1 Foo1 8 | use Foo2 Foo2 9 | 10 | x = match Foo0 with 11 | Foo0 -> 1 12 | 13 | y = match Foo1 1 with 14 | Foo1 1 -> 0 15 | Foo1 _ -> 10 16 | 17 | z = match Foo2 1 "hi" with 18 | Foo2 1 "hi" -> 1 19 | Foo2 x "bye" -> x 20 | _ -> bug "unexpected" 21 | 22 | > z 23 | -------------------------------------------------------------------------------- /unison-src/tests/pattern-typing-bug.u: -------------------------------------------------------------------------------- 1 | structural type Value = String Text 2 | | Bool Boolean 3 | 4 | f : Value -> Nat 5 | f = cases 6 | Value.Bool true -> 3 7 | _ -> 4 8 | 9 | > f (Value.String "foo") 10 | -------------------------------------------------------------------------------- /unison-src/tests/pattern-typing-bug.ur: -------------------------------------------------------------------------------- 1 | 4 2 | -------------------------------------------------------------------------------- /unison-src/tests/pattern-weirdness.u: -------------------------------------------------------------------------------- 1 | go = 2 | a = 1 3 | match "" with 4 | pos | false -> a 5 | _ -> a 6 | 7 | > go 8 | 9 | -- 7 | > go 10 | -- ⧩ 11 | -- "" 12 | 13 | -- should be 1, not "" 14 | 15 | -- seems to have something to do with the wildcard + guard, as changing or 16 | -- or deleting that line makes the problem go away 17 | -------------------------------------------------------------------------------- /unison-src/tests/pattern-weirdness.ur: -------------------------------------------------------------------------------- 1 | 1 2 | -------------------------------------------------------------------------------- /unison-src/tests/quote-parse-bug.uu: -------------------------------------------------------------------------------- 1 | 2 | blah : a -> a -> a 3 | blah a a2 = a2 4 | 5 | > blah '"hi" '"arya" 6 | 7 | -------------------------------------------------------------------------------- /unison-src/tests/r0.u: -------------------------------------------------------------------------------- 1 | r0 : Nat 2 | r0 = match Optional.Some 3 with 3 | x -> 1 4 | 5 | > r0 6 | -------------------------------------------------------------------------------- /unison-src/tests/r1.u: -------------------------------------------------------------------------------- 1 | --r1 2 | structural type Optional a = None | Some a 3 | r1 : Nat 4 | r1 = match Optional.Some 3 with 5 | x -> 1 6 | 7 | -------------------------------------------------------------------------------- /unison-src/tests/r10.u: -------------------------------------------------------------------------------- 1 | r10 : Nat 2 | r10 = match 1 with 3 | 1 | true -> 3 4 | _ -> 4 5 | 6 | -------------------------------------------------------------------------------- /unison-src/tests/r11.u: -------------------------------------------------------------------------------- 1 | use Universal == 2 | 3 | r11 : Nat 4 | r11 = match 1 with 5 | 1 | 2 == 3 -> 4 6 | _ -> 5 7 | 8 | -------------------------------------------------------------------------------- /unison-src/tests/r12.u: -------------------------------------------------------------------------------- 1 | r12 : Nat 2 | r12 = (x -> x) 64 3 | 4 | 5 | -------------------------------------------------------------------------------- /unison-src/tests/r13.u: -------------------------------------------------------------------------------- 1 | r13 : (Nat, Text) 2 | r13 = 3 | id = ((x -> x): forall a. a -> a) 4 | (id 10, id "foo") 5 | 6 | -------------------------------------------------------------------------------- /unison-src/tests/r14.u: -------------------------------------------------------------------------------- 1 | r14 : (forall a . a -> a) -> (Nat, Text) 2 | r14 id = (id 10, id "foo") 3 | 4 | 5 | -------------------------------------------------------------------------------- /unison-src/tests/r2.u: -------------------------------------------------------------------------------- 1 | structural type Optional a = None | Some a 2 | r2 : Nat 3 | r2 = match Optional.Some true with 4 | Optional.Some true -> 1 5 | Optional.Some false -> 0 6 | Optional.None -> bug "unexpected" 7 | 8 | -------------------------------------------------------------------------------- /unison-src/tests/r3.u: -------------------------------------------------------------------------------- 1 | r3 : Nat 2 | r3 = match Optional.Some true with 3 | Optional.Some true -> 1 4 | Optional.Some false -> 0 5 | Optional.None -> bug "unexpected" 6 | 7 | 8 | -------------------------------------------------------------------------------- /unison-src/tests/r4negate.u: -------------------------------------------------------------------------------- 1 | r4 : Int -> Int 2 | r4 x = match x with 3 | +1 -> -1 4 | _ -> Int.negate x 5 | 6 | -------------------------------------------------------------------------------- /unison-src/tests/r4x.u: -------------------------------------------------------------------------------- 1 | r4 : Int -> Int 2 | r4 = cases 3 | +1 -> +1 4 | x -> x 5 | -------------------------------------------------------------------------------- /unison-src/tests/r5.u: -------------------------------------------------------------------------------- 1 | r5 : Float 2 | r5 = match 2.2 with 3 | r | abs (r - 2.2) <= 0.01 -> 3.0 4 | _ -> 1.0 5 | 6 | 7 | -------------------------------------------------------------------------------- /unison-src/tests/r6.u: -------------------------------------------------------------------------------- 1 | r6 : () 2 | r6 = match () with 3 | () -> () 4 | 5 | -------------------------------------------------------------------------------- /unison-src/tests/r7.0.u: -------------------------------------------------------------------------------- 1 | r7 : Nat 2 | r7 = match () with 3 | () -> 1 4 | 5 | > r7 6 | 7 | -------------------------------------------------------------------------------- /unison-src/tests/r7.1.u: -------------------------------------------------------------------------------- 1 | r7 : Nat 2 | r7 = match () with 3 | x@() -> 1 4 | 5 | 6 | -------------------------------------------------------------------------------- /unison-src/tests/r7.2.u: -------------------------------------------------------------------------------- 1 | r7 : () 2 | r7 = match () with 3 | x@() -> x 4 | 5 | -------------------------------------------------------------------------------- /unison-src/tests/r8.u: -------------------------------------------------------------------------------- 1 | r8 = match (1,(2,(3,(4,(5,(6,(7,8))))))) with 2 | (x,(y,(_,_))) -> 0 3 | 4 | > r8 5 | 6 | -------------------------------------------------------------------------------- /unison-src/tests/r9.u: -------------------------------------------------------------------------------- 1 | r9 : Nat 2 | r9 = match 1 with 3 | 9 -> 9 4 | 8 -> 8 5 | 7 -> 7 6 | 6 -> 6 7 | 5 -> 5 8 | _ -> 1 9 | 10 | > r9 11 | 12 | -------------------------------------------------------------------------------- /unison-src/tests/records.u: -------------------------------------------------------------------------------- 1 | 2 | structural type Point x y = { x : x, y : y } 3 | 4 | structural type Point2 = { point2 : Nat, f : Nat } 5 | 6 | structural type Monoid a = { zero : a, plus : a -> a -> a } 7 | 8 | > Point.x.set 10 (Point 0 0) 9 | > Point.x (Point 10 0) 10 | > Point.y (Point 0 10) 11 | > Point.x.modify ((+) 1) (Point 0 0) 12 | > Point.y.modify ((+) 1) (Point 0 0) 13 | -------------------------------------------------------------------------------- /unison-src/tests/runtime-crash.uu: -------------------------------------------------------------------------------- 1 | 2 | drop1 = Text.drop 1 3 | 4 | > drop1 "heyo" 5 | 6 | --- 7 | 8 | gives a runtime error - 9 | 10 | unison: user error (type error, expecting N, got "heyo") 11 | 12 | which indicates it is going to the runtime stack to get that `1` value, 13 | rather than pulling it from the arguments 14 | -------------------------------------------------------------------------------- /unison-src/tests/sequence-at-0.u: -------------------------------------------------------------------------------- 1 | > match at 0 [100] with 2 | Optional.Some _ -> "Hooray!" 3 | Optional.None -> bug "unexpected" 4 | -------------------------------------------------------------------------------- /unison-src/tests/sequence-literal-argument-parsing.u: -------------------------------------------------------------------------------- 1 | structural type X a = X [a] 2 | 3 | f : X a -> a 4 | f = cases 5 | X.X [b] -> b 6 | X.X _ -> bug "unexpected" 7 | -------------------------------------------------------------------------------- /unison-src/tests/sequence-literal.u: -------------------------------------------------------------------------------- 1 | a = [1,2,3] 2 | b = [1 ,2 ,3 3 | ] 4 | c = [ 1 , 2 , 3 ] 5 | d = [ 1 6 | , 2 7 | , 3 ] 8 | e = [ 1 9 | , 2 10 | , 3 11 | ] 12 | f = 13 | [ 1 14 | , 2 15 | , 3 16 | ] 17 | g = [ 1 18 | , 2, 19 | 3 ] 20 | -------------------------------------------------------------------------------- /unison-src/tests/spurious-ability-fail-underapply.u: -------------------------------------------------------------------------------- 1 | structural ability Woot where 2 | woot : {Woot} Nat 3 | 4 | wha : ((a ->{Woot} a) -> a ->{Woot} a) -> Nat 5 | wha f = 6 | blah a = f' a 7 | f' : a ->{Woot} a 8 | f' = f blah 9 | 42 10 | -------------------------------------------------------------------------------- /unison-src/tests/spurious-ability-fail.u: -------------------------------------------------------------------------------- 1 | --The expression in red needs the {𝛆} ability, but this location only has access to the {𝛆} ability, 2 | -- 3 | -- 8 | odd n = if n == 1 then true else even2 (drop n 1) 4 | 5 | use Universal == 6 | 7 | even : Nat -> Boolean 8 | even n = if n == 0 then true else odd (drop n 1) 9 | 10 | odd : Nat -> Boolean 11 | odd n = if n == 1 then true else even2 (drop n 1) 12 | 13 | even2 = even 14 | 15 | increment : Nat -> Nat -- signature is optional 16 | increment n = n + 1 17 | -------------------------------------------------------------------------------- /unison-src/tests/state1.u: -------------------------------------------------------------------------------- 1 | --State1 ability 2 | structural ability State se2 where 3 | put : ∀ se . se -> {State se} () 4 | get : ∀ se . () -> {State se} se 5 | 6 | -- state : ∀ s a . s -> Request (State s) a -> (s, a) 7 | state woot = cases 8 | { State.put snew -> k } -> handle k () with state snew 9 | { State.get () -> k } -> handle k woot with state woot 10 | { a } -> (woot, a) 11 | 12 | blah : ∀ s a . s -> Request (State s) a -> (s, a) 13 | blah = state 14 | 15 | > () 16 | -------------------------------------------------------------------------------- /unison-src/tests/state1a.u: -------------------------------------------------------------------------------- 1 | --State1a ability 2 | structural ability State se2 where 3 | put : ∀ se . se -> {State se} () 4 | get : ∀ se . {State se} se 5 | id : Int -> Int 6 | id i = i 7 | foo : () -> {State Int} Int 8 | foo unit = id (State.get Int.+ State.get) 9 | 10 | > () 11 | 12 | -------------------------------------------------------------------------------- /unison-src/tests/state2.u: -------------------------------------------------------------------------------- 1 | --State2 ability 2 | structural ability State se2 where 3 | put : ∀ se . se -> {State se} () 4 | get : ∀ se . () -> {State se} se 5 | state : ∀ s a . s -> Request (State s) a -> (s, a) 6 | state woot = cases 7 | { State.get () -> k } -> handle k woot with state woot 8 | { State.put snew -> k } -> handle k () with state snew 9 | { a } -> (woot, a) 10 | 11 | > () 12 | -------------------------------------------------------------------------------- /unison-src/tests/state2a-min.u: -------------------------------------------------------------------------------- 1 | --State2 ability 2 | structural ability State s where 3 | put : s -> {State s} () 4 | 5 | state : s -> Request (State s) a -> a 6 | state s = cases 7 | { State.put snew -> k } -> handle k () with state snew 8 | { a } -> a 9 | 10 | ex : Text 11 | ex = handle 12 | State.put (11 + 1) 13 | State.put (5 + 5) 14 | "hello" 15 | with state 10 16 | 17 | > ex 18 | -------------------------------------------------------------------------------- /unison-src/tests/state2a-min.ur: -------------------------------------------------------------------------------- 1 | "hello" 2 | -------------------------------------------------------------------------------- /unison-src/tests/state2b-min.u: -------------------------------------------------------------------------------- 1 | --State2 ability 2 | structural ability State s where 3 | put : s -> {State s} () 4 | 5 | state : s -> Request (State s) a -> s 6 | state s = cases 7 | { State.put snew -> k } -> handle k () with state snew 8 | { a } -> s 9 | 10 | > handle 11 | State.put (11 + 1) 12 | State.put (5 + 15) 13 | () 14 | with state 10 15 | -- should be 20 16 | -------------------------------------------------------------------------------- /unison-src/tests/state2b-min.ur: -------------------------------------------------------------------------------- 1 | 20 2 | -------------------------------------------------------------------------------- /unison-src/tests/state4.u: -------------------------------------------------------------------------------- 1 | structural ability State s where 2 | put : s -> {State s} () 3 | get : {State s} s 4 | 5 | state : s -> Request (State s) a -> s 6 | state s = cases 7 | { State.get -> k } -> handle k s with state s 8 | { State.put snew -> k } -> handle k () with state snew 9 | { a } -> s 10 | 11 | modify : (s ->{} s) -> {State s} () 12 | modify f = State.put (f State.get) 13 | 14 | increment : '{State Nat} () 15 | increment = '(modify ((+) 1)) 16 | 17 | ex : Nat 18 | ex = handle 19 | State.put (11 + 1) 20 | !increment 21 | !increment 22 | !increment 23 | State.get -- should be 15, amirite?? 24 | with state 10 25 | 26 | > ex 27 | -------------------------------------------------------------------------------- /unison-src/tests/state4.ur: -------------------------------------------------------------------------------- 1 | 15 2 | -------------------------------------------------------------------------------- /unison-src/tests/state4a.u: -------------------------------------------------------------------------------- 1 | structural ability State s where 2 | put : s -> {State s} () 3 | get : {State s} s 4 | 5 | state : s -> Request (State s) a -> s 6 | state s = cases 7 | { State.get -> k } -> handle k s with state s 8 | { State.put snew -> k } -> handle k () with state snew 9 | { a } -> s 10 | 11 | modify : (s ->{} s) -> {State s} () 12 | modify f = State.put (f State.get) 13 | 14 | increment : '{State Nat} () 15 | increment = '(modify ((+) 1)) 16 | 17 | ex : Nat 18 | ex = handle 19 | State.put (11 + 1) 20 | -- !increment 21 | -- !increment 22 | -- !increment 23 | State.get -- should be 15, amirite?? 24 | with state 10 25 | 26 | > ex 27 | -------------------------------------------------------------------------------- /unison-src/tests/state4a.ur: -------------------------------------------------------------------------------- 1 | 12 2 | -------------------------------------------------------------------------------- /unison-src/tests/suffix-resolve.u: -------------------------------------------------------------------------------- 1 | 2 | -- This file shows that any unique suffix can be used to refer 3 | -- to a definition. 4 | 5 | -- no imports needed here, even though FQN is builtin.Int 6 | foo : Int 7 | foo = +1 8 | 9 | -- no imports needed here, even though FQNs are Optional.{None,Some} 10 | ex1 = cases 11 | None -> 0 12 | Some a -> a + 1 13 | 14 | -- you can still use the FQN 15 | ex2 = cases 16 | Optional.None -> 99 17 | Optional.Some _ -> 0 18 | 19 | ex3 = List.at 0 [ 1, 2, 3, 4 ] 20 | 21 | -- TDNR would have handled this one before, but TDNR can't do 22 | -- type resolution or pattern resolution 23 | zoink = Some 42 24 | -------------------------------------------------------------------------------- /unison-src/tests/tdnr.u: -------------------------------------------------------------------------------- 1 | -- Should resolve + with Type-directeded name resolution 2 | 3 | x : Nat 4 | x = 4 + 2 5 | -------------------------------------------------------------------------------- /unison-src/tests/tdnr2.u: -------------------------------------------------------------------------------- 1 | x : Nat 2 | x = 42 + 2 3 | 4 | y : Int 5 | y = +42 + -2 6 | 7 | z : Float 8 | z = 42.0 - 2.0 9 | 10 | foo a b = (a + b) + 3 11 | 12 | bar a b = 3 + b + a 13 | 14 | -------------------------------------------------------------------------------- /unison-src/tests/tdnr3.u: -------------------------------------------------------------------------------- 1 | -- Local definitions should be resolved by type 2 | 3 | Foo.bar x = x + 1 4 | 5 | z = bar 99 6 | 7 | -------------------------------------------------------------------------------- /unison-src/tests/tdnr4.u: -------------------------------------------------------------------------------- 1 | x = None 2 | 3 | y = Some 10 4 | 5 | -------------------------------------------------------------------------------- /unison-src/tests/text-escaping.u: -------------------------------------------------------------------------------- 1 | id x = x 2 | 3 | x = id ("\n") 4 | 5 | find : Text -> Text 6 | find s = match (Text.take 1 s) with 7 | "\n" -> "found" 8 | _ -> "not found" 9 | 10 | > (x, find "\nbar") 11 | -------------------------------------------------------------------------------- /unison-src/tests/text-escaping.ur: -------------------------------------------------------------------------------- 1 | ("\n", "found") 2 | -------------------------------------------------------------------------------- /unison-src/tests/text-pattern.u: -------------------------------------------------------------------------------- 1 | foo = cases 2 | "xyz" -> false 3 | "abc" -> true 4 | _ -> false 5 | 6 | > (foo "abc", foo "xyz", foo "hello, world") 7 | -------------------------------------------------------------------------------- /unison-src/tests/text-pattern.ur: -------------------------------------------------------------------------------- 1 | (true, false, false) 2 | -------------------------------------------------------------------------------- /unison-src/tests/tictactoe0-array-oob1.u: -------------------------------------------------------------------------------- 1 | -- board piece 2 | 3 | structural type Board = Board Nat Nat Nat 4 | 5 | use Board Board 6 | 7 | -- uncommenting these gives errors from NPE to array index out of bounds -1, -2 8 | -- x = 1 9 | -- y = 2 10 | 11 | ex = match Board 77 88 99 with 12 | Board a b c -> c 13 | -------------------------------------------------------------------------------- /unison-src/tests/tictactoe0-npe.u: -------------------------------------------------------------------------------- 1 | -- board piece 2 | structural type P = X | O | E 3 | 4 | structural type Board = Board P P P P P P P P P 5 | 6 | use Board Board 7 | use P O X E 8 | 9 | whatevs a b c = a 10 | 11 | b = Board X O X O X X O E X 12 | x = 1 13 | y = 2 14 | z = 3 15 | 16 | ex = match b with 17 | Board a b c d e f g h i -> a 18 | -------------------------------------------------------------------------------- /unison-src/tests/tuple.u: -------------------------------------------------------------------------------- 1 | (+) = (Nat.+) 2 | 3 | > match (1,2,3,4) with 4 | (a,b,c,d) -> (a + b, c + d) 5 | -------------------------------------------------------------------------------- /unison-src/tests/tuple.ur: -------------------------------------------------------------------------------- 1 | (3,7) 2 | -------------------------------------------------------------------------------- /unison-src/tests/type-application.u: -------------------------------------------------------------------------------- 1 | 2 | structural ability Foo where 3 | foo : {Foo} Nat 4 | 5 | structural type Wrap a = Wrap Nat 6 | structural type C = C (Wrap {}) -- constrain Wrap kind 7 | 8 | blah : Wrap {Foo} -> Nat 9 | blah = cases 10 | Wrap.Wrap n -> n + 1 11 | 12 | > blah (Wrap 99) 13 | -------------------------------------------------------------------------------- /unison-src/tests/underscore-parsing.u: -------------------------------------------------------------------------------- 1 | _prefix = 1 2 | prefix_ _x = _x 3 | _prefix_ _ = 2 4 | -------------------------------------------------------------------------------- /unison-src/tests/ungeneralize-bug.uu: -------------------------------------------------------------------------------- 1 | 2 | use Foo Foo 3 | use Optional Some None 4 | 5 | structural type Foo a b = Foo a (Optional b) 6 | 7 | foo : Foo a b -> (b -> c) -> Foo a c 8 | foo x f = match x with 9 | Foo a None -> Foo a None 10 | 11 | -- 12 | -- 🌻 /Users/pchiusano/work/unison/unison-src/tests/typechecker-bug.u has changed, reloading... 13 | -- I found a value of type b where I expected to find one of type c: 14 | -- 15 | -- 7 | foo : Foo a b -> (b -> c) -> Foo a c 16 | -- 8 | foo x f = match x with 17 | -- 9 | Foo a None -> Foo a None 18 | -- 19 | -- from right here: 20 | -- 21 | -- 7 | foo : Foo a b -> (b -> c) -> Foo a c 22 | -- shouldn't be a type error 23 | -------------------------------------------------------------------------------- /unison-src/tests/unique.u: -------------------------------------------------------------------------------- 1 | 2 | unique ability Zing where zing : {Zang} Nat 3 | 4 | unique[asdlfkjasdflkj] ability Zang where 5 | zang : {Zing} Nat 6 | 7 | unique 8 | ability Blarg where 9 | oog : {Blarg} Text 10 | 11 | unique type Bool = T | F 12 | 13 | unique[sdalfkjsdf] type BetterBool = Ya | Nah 14 | 15 | unique[asdflkajsdf] type Day 16 | = Sun | Mon | Tue | Wed | Thu | Fri | Sat 17 | 18 | id x = x 19 | 20 | unique type Day2 21 | = Sun 22 | | Mon 23 | | Tue 24 | | Wed 25 | | Thu 26 | | Fri 27 | | Sat 28 | 29 | -------------------------------------------------------------------------------- /unison-src/tests/void.u: -------------------------------------------------------------------------------- 1 | structural type Void = 2 | 3 | > 3 4 | -------------------------------------------------------------------------------- /unison-src/transcripts-manual/README.md: -------------------------------------------------------------------------------- 1 | This directory contains transcripts which are committed, but must be run manually for some reason or another, perhaps they call out over the network, or are too slow to run in CI. 2 | -------------------------------------------------------------------------------- /unison-src/transcripts-manual/benchmarks/array-sort.u: -------------------------------------------------------------------------------- 1 | 2 | use Nat mod 3 | 4 | shuffle : Nat -> Nat 5 | shuffle n = 6 | mod (n*n) 31397 7 | 8 | cmp : Nat -> Nat -> Ordering 9 | cmp m n = match compare m n with 10 | -1 -> Less 11 | +0 -> Equal 12 | +1 -> Greater 13 | _ -> Less 14 | 15 | main = do 16 | list = map shuffle <| range 1000 2000 17 | timeit "array_sort" '(sort.List.sortBy cmp list) 18 | -------------------------------------------------------------------------------- /unison-src/transcripts-manual/benchmarks/each.u: -------------------------------------------------------------------------------- 1 | 2 | main = do 3 | timeit "Each" '(List.size <| Each.toList do 4 | x = Each.range 0 100 5 | y = Each.range 0 100 6 | x + y) -------------------------------------------------------------------------------- /unison-src/transcripts-manual/benchmarks/fibonacci.u: -------------------------------------------------------------------------------- 1 | 2 | -- inefficient (exponential) fibonacci number 3 | -- mostly measures function call overhead 4 | fib n = match n with 5 | 0 -> 0 6 | 1 -> 1 7 | n -> fib (n - 1) + fib (n - 2) 8 | 9 | main = do 10 | timeit "fibonacci" '(fib 22) -------------------------------------------------------------------------------- /unison-src/transcripts-manual/benchmarks/listfilter.u: -------------------------------------------------------------------------------- 1 | 2 | main = do 3 | timeit "List.filter" '(range 0 10000 |> List.filter (x -> Nat.mod x 3 == 0) |> List.size) -------------------------------------------------------------------------------- /unison-src/transcripts-manual/benchmarks/listmap.u: -------------------------------------------------------------------------------- 1 | 2 | main = do 3 | timeit "List.map" '(range 0 10000 |> List.map (x -> x + 1) |> List.size) -------------------------------------------------------------------------------- /unison-src/transcripts-manual/benchmarks/map.u: -------------------------------------------------------------------------------- 1 | 2 | -- insert 10k numbers into a map 3 | go acc n = 4 | if n == 1000 then Map.size acc 5 | else 6 | k = Nat.mod ( n * n ) 115249 7 | acc' = Map.insert k k acc 8 | match Map.lookup k acc' with 9 | Some a -> go acc' (n + 1) 10 | None -> bug "Map implementation is busted" 11 | 12 | main = do 13 | timeit "Map" '(go Map.empty 0) -------------------------------------------------------------------------------- /unison-src/transcripts-manual/benchmarks/natmap.u: -------------------------------------------------------------------------------- 1 | 2 | -- insert 10k numbers into a map 3 | go acc n = 4 | if n == 300 then NatMap.size acc 5 | else 6 | k = n -- Nat.mod ( n * n ) 115249 7 | acc' = toNatMap (NatMap.insert k k acc) 8 | match NatMap.get k acc' with 9 | Some a -> go acc' (n + 1) 10 | None -> bug "Map implementation is busted" 11 | 12 | main = do 13 | timeit "NatMap" '(go NatMap.empty 0) -------------------------------------------------------------------------------- /unison-src/transcripts-manual/benchmarks/random.u: -------------------------------------------------------------------------------- 1 | 2 | -- sum up a bunch of random numbers 3 | go acc n = 4 | if n == 10000 then acc 5 | else go (acc + Random.natIn 0 1000) (n + 1) 6 | 7 | main = do 8 | timeit "random" '(splitmix 19 '(go 0 0)) -------------------------------------------------------------------------------- /unison-src/transcripts-manual/benchmarks/simpleloop.u: -------------------------------------------------------------------------------- 1 | 2 | -- sum the numbers 1 to a million 3 | loop acc rem = match rem with 4 | 0 -> acc 5 | _ -> loop (acc + rem) (rem - 1) 6 | 7 | main = do 8 | timeit "simple_loop" '(loop 0 1000000) -------------------------------------------------------------------------------- /unison-src/transcripts-manual/benchmarks/stm.u: -------------------------------------------------------------------------------- 1 | 2 | use TVar read write 3 | 4 | -- sum the numbers 1 to a million 5 | loop var = cases 6 | 0 -> readIO var 7 | n -> 8 | atomically do 9 | write var (read var + n) 10 | loop var (n - 1) 11 | 12 | main = do 13 | timeit "stm_loop" '(loop (TVar.newIO 0) 100000) 14 | -------------------------------------------------------------------------------- /unison-src/transcripts-manual/docs.to-html.md: -------------------------------------------------------------------------------- 1 | ``` ucm 2 | test-html-docs/main> builtins.mergeio lib.builtins 3 | ``` 4 | 5 | ``` unison 6 | {{A doc directly in the namespace.}} 7 | some.ns.direct = 1 8 | 9 | {{A doc pretty deeply nested in the namespace.}} 10 | some.ns.pretty.deeply.nested = 2 11 | 12 | {{A doc outside the namespace.}} 13 | some.outside = 3 14 | ``` 15 | 16 | ``` ucm 17 | test-html-docs/main> add 18 | test-html-docs/main> docs.to-html some.ns unison-src/transcripts-manual/docs.to-html 19 | ``` 20 | -------------------------------------------------------------------------------- /unison-src/transcripts-manual/docs.to-html/direct/doc.html: -------------------------------------------------------------------------------- 1 |
A doc directly in the namespace.
-------------------------------------------------------------------------------- /unison-src/transcripts-manual/docs.to-html/pretty/deeply/nested/doc.html: -------------------------------------------------------------------------------- 1 |
A doc pretty deeply nested in the namespace.
-------------------------------------------------------------------------------- /unison-src/transcripts-manual/remote-tab-completion.md: -------------------------------------------------------------------------------- 1 | ## Tab complete against Share 2 | 3 | Note: this makes a network call to share to get completions. It seems to be nonfunctioning at the moment, hence the `:bug` tags. 4 | 5 | ``` ucm :bug 6 | scratch/main> debug.tab-complete pull @uniso 7 | ``` 8 | 9 | ``` ucm :bug 10 | scratch/main> debug.tab-complete pull @unison/ba 11 | ``` 12 | -------------------------------------------------------------------------------- /unison-src/transcripts-manual/remote-tab-completion.output.md: -------------------------------------------------------------------------------- 1 | ## Tab complete against Share 2 | 3 | Note: this makes a network call to share to get completions. It seems to be nonfunctioning at the moment, hence the `:bug` tags. 4 | 5 | ``` ucm :bug 6 | scratch/main> debug.tab-complete pull @uniso 7 | 8 | ``` 9 | 10 | ``` ucm :bug 11 | scratch/main> debug.tab-complete pull @unison/ba 12 | 13 | ``` 14 | -------------------------------------------------------------------------------- /unison-src/transcripts-round-trip/docTest2.u: -------------------------------------------------------------------------------- 1 | docTest2 : Doc2 2 | docTest2 = 3 | {{ # Full doc body indented 4 | 5 | ``` raw 6 | myVal1 = 42 7 | myVal2 = 43 8 | myVal4 = 44 9 | ``` 10 | 11 | ``` raw 12 | indented1= "hi" 13 | indented2="this is two indents" 14 | ``` 15 | 16 | I am two spaces over }} 17 | 18 | ---- Anything below this line is ignored by Unison. 19 | 20 | 21 | docTest2 = {{ 22 | # Full doc body indented 23 | 24 | ````raw 25 | myVal1 = 42 26 | myVal2 = 43 27 | myVal4 = 44 28 | ```` 29 | 30 | ````raw 31 | indented1= "hi" 32 | indented2="this is two indents" 33 | ```` 34 | I am two spaces over 35 | }} 36 | -------------------------------------------------------------------------------- /unison-src/transcripts-round-trip/ex2.u: -------------------------------------------------------------------------------- 1 | b = 92384 2 | -------------------------------------------------------------------------------- /unison-src/transcripts-round-trip/reparses.u: -------------------------------------------------------------------------------- 1 | 2 | explanationOfThisFile = """ 3 | Put definitions in here that are expected to 4 | parse with a different hash after pretty-printing. 5 | """ 6 | 7 | -- This is expected to round trip with the ``` syntax, 8 | -- even though the original didn't use that syntax and 9 | -- defined the eval block with a lambda rather than a delay. 10 | sloppyDocEval = 11 | docUntitledSection [ 12 | docParagraph [ 13 | docWord "Here's an example of an eval block that's", 14 | docWord "technically a lambda but should print as a", 15 | docWord "backticked block (since old docs in the wild", 16 | docWord "still use this format)." 17 | ], 18 | docEval (_ -> 1 Nat.+ 1) 19 | ] 20 | -------------------------------------------------------------------------------- /unison-src/transcripts-using-base/README: -------------------------------------------------------------------------------- 1 | Transcripts in this directory are only run using the new runtime. 2 | -------------------------------------------------------------------------------- /unison-src/transcripts-using-base/all-base-hashes.md: -------------------------------------------------------------------------------- 1 | This transcript is intended to make visible accidental changes to the hashing algorithm. 2 | 3 | ``` ucm 4 | scratch/main> find.verbose 5 | ``` 6 | -------------------------------------------------------------------------------- /unison-src/transcripts-using-base/fix2049.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unisonweb/unison/07a855e4674837f6506957055fc58d901e922715/unison-src/transcripts-using-base/fix2049.md -------------------------------------------------------------------------------- /unison-src/transcripts-using-base/fix2049.output.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /unison-src/transcripts-using-base/fix2358.md: -------------------------------------------------------------------------------- 1 | Tests a former error due to bad calling conventions on delay.impl 2 | 3 | ``` unison 4 | timingApp2 : '{IO, Exception} () 5 | timingApp2 _ = 6 | printLine "Hello" 7 | delay 10 8 | printLine "World" 9 | ``` 10 | 11 | ``` ucm 12 | scratch/main> run timingApp2 13 | ``` 14 | -------------------------------------------------------------------------------- /unison-src/transcripts-using-base/fix2358.output.md: -------------------------------------------------------------------------------- 1 | Tests a former error due to bad calling conventions on delay.impl 2 | 3 | ``` unison 4 | timingApp2 : '{IO, Exception} () 5 | timingApp2 _ = 6 | printLine "Hello" 7 | delay 10 8 | printLine "World" 9 | ``` 10 | 11 | ``` ucm :added-by-ucm 12 | Loading changes detected in scratch.u. 13 | 14 | I found and typechecked these definitions in scratch.u. If you 15 | do an `update`, here's how your codebase would change: 16 | 17 | ⍟ These new definitions are ok to `update`: 18 | 19 | timingApp2 : '{IO, Exception} () 20 | ``` 21 | 22 | ``` ucm 23 | scratch/main> run timingApp2 24 | 25 | () 26 | ``` 27 | -------------------------------------------------------------------------------- /unison-src/transcripts-using-base/fix2944.md: -------------------------------------------------------------------------------- 1 | This bugfix reduces "_eta" expanded terms from the decompiler 2 | before pretty-printing. 3 | 4 | ```unison 5 | ability Foo where 6 | foo : Nat -> Nat 7 | ``` 8 | 9 | ```ucm 10 | scratch/main> add 11 | ``` 12 | 13 | ````unison 14 | bar = {{ 15 | @typecheck``` 16 | 0 |> foo |> foo 17 | ``` 18 | }} 19 | ```` 20 | 21 | ``` ucm 22 | scratch/main> display bar 23 | ``` 24 | 25 | Previously would get rendered as: 26 | 27 | ``` 28 | 0 |> (_eta -> foo _eta) |> (_eta -> foo _eta) 29 | ``` 30 | 31 | But should be: 32 | 33 | ``` 34 | 0 |> foo |> foo 35 | ``` -------------------------------------------------------------------------------- /unison-src/transcripts-using-base/fix3542.md: -------------------------------------------------------------------------------- 1 | ``` unison 2 | arrayList v n = do 3 | use ImmutableByteArray read8 4 | ma = Scope.bytearrayOf v n 5 | a = freeze! ma 6 | go acc i = 7 | acc' = [read8 a i] ++ acc 8 | if i == 0 9 | then acc' 10 | else go acc' (drop i 1) 11 | go [] (drop n 1) 12 | 13 | > Scope.run '(catch (arrayList 7 8)) 14 | ``` 15 | -------------------------------------------------------------------------------- /unison-src/transcripts-using-base/fix3939.md: -------------------------------------------------------------------------------- 1 | ``` unison 2 | {{ 3 | A simple doc. 4 | }} 5 | meh = 9 6 | ``` 7 | 8 | ``` ucm 9 | scratch/main> add 10 | scratch/main> find meh 11 | scratch/main> docs 1 12 | ``` 13 | -------------------------------------------------------------------------------- /unison-src/transcripts-using-base/fix3939.output.md: -------------------------------------------------------------------------------- 1 | ``` unison 2 | {{ 3 | A simple doc. 4 | }} 5 | meh = 9 6 | ``` 7 | 8 | ``` ucm :added-by-ucm 9 | Loading changes detected in scratch.u. 10 | 11 | I found and typechecked these definitions in scratch.u. If you 12 | do an `update`, here's how your codebase would change: 13 | 14 | ⍟ These new definitions are ok to `update`: 15 | 16 | meh : Nat 17 | meh.doc : Doc2 18 | ``` 19 | 20 | ``` ucm 21 | scratch/main> add 22 | 23 | Okay, I'm searching the branch for code that needs to be 24 | updated... 25 | 26 | Done. 27 | 28 | scratch/main> find meh 29 | 30 | 1. meh : Nat 31 | 2. meh.doc : Doc2 32 | 33 | scratch/main> docs 1 34 | 35 | A simple doc. 36 | ``` 37 | -------------------------------------------------------------------------------- /unison-src/transcripts-using-base/fix5178.md: -------------------------------------------------------------------------------- 1 | ``` unison 2 | foo = {{ 3 | @source{Stream.emit} 4 | }} 5 | ``` 6 | 7 | ``` ucm 8 | scratch/main> add 9 | ``` 10 | 11 | Viewing `foo` via `scratch/main> ui` shows the correct source, but `display foo` gives us an error message (but not an error – this is incorrectly considered a successful result) 12 | 13 | I think there are two separate issues here: 14 | 15 | 1. this message should be considered an error, not success; and 16 | 2. this should actually work like `ui` and give us the source of the ability member, not complain about there being no such term in the codebase. 17 | 18 | ``` ucm :error :bug 19 | scratch/main> display foo 20 | ``` 21 | -------------------------------------------------------------------------------- /unison-src/transcripts-using-base/replacements.md: -------------------------------------------------------------------------------- 1 | 2 | Tests related to automatic replacement of unison types/functions by 3 | builtins. 4 | 5 | ``` unison 6 | theMap = Bin 2 1 2 (Bin 1 0 1 Tip Tip) (Bin 1 3 4 Tip Tip) 7 | 8 | testIt = do 9 | v = value theMap 10 | match load v with 11 | Right m -> 12 | match Map.get 1 m with 13 | Some 2 -> Ok "Passed" 14 | _ -> Fail "wrong lookup value" 15 | _ -> Fail "could not load value" 16 | 17 | mapTests = do [!testIt] 18 | 19 | > Map.get 1 20 | ``` 21 | 22 | ``` ucm 23 | scratch/main> add 24 | scratch/main> io.test mapTests 25 | ``` 26 | -------------------------------------------------------------------------------- /unison-src/transcripts-using-base/serial-test-01.md: -------------------------------------------------------------------------------- 1 | ``` unison 2 | l1 = [1.0,2.0,3.0] 3 | l2 = [+1,+2,+3] 4 | l3 = [?a, ?b, ?c] 5 | 6 | combines = cases 7 | (x, y, z) -> 8 | rx = foldLeft (+) 0.0 x 9 | ry = foldLeft (+) +0 y 10 | rz = foldLeft (t c -> t ++ Char.toText c) "" z 11 | 12 | "(" ++ toText rx ++ ", " ++ toText ry ++ ", \"" ++ rz ++ "\")" 13 | 14 | mkTestCase = do 15 | saveTestCase "case-01" "v4" combines (l1, l2, l3) 16 | ``` 17 | 18 | ``` ucm 19 | scratch/main> add 20 | scratch/main> run mkTestCase 21 | ``` 22 | -------------------------------------------------------------------------------- /unison-src/transcripts-using-base/serial-test-04.md: -------------------------------------------------------------------------------- 1 | ``` unison 2 | 3 | mutual0 = cases 4 | 0 -> "okay" 5 | n -> 6 | _ = openFile 7 | mutual1 (drop n 1) 8 | 9 | mutual1 n = 10 | mutual0 n 11 | 12 | mkTestCase = do 13 | saveTestCase "case-04" "v4" mutual1 5 14 | ``` 15 | 16 | ``` ucm 17 | scratch/main> add 18 | scratch/main> run mkTestCase 19 | ``` 20 | -------------------------------------------------------------------------------- /unison-src/transcripts-using-base/serialized-cases/case-00.out: -------------------------------------------------------------------------------- 1 | (10, 45, 65, hello goodbye) -------------------------------------------------------------------------------- /unison-src/transcripts-using-base/serialized-cases/case-00.v4.hash: -------------------------------------------------------------------------------- 1 | Z6EW6IDZJXHDMNGTVSKYLMZVG47ORYF4O6JDQXQGQFJP476SLM75FXFOYI27OJHMIX5OIHKQ6LXWLYQ5LDGEYWEXK6GQPP6JKH6SVMI= -------------------------------------------------------------------------------- /unison-src/transcripts-using-base/serialized-cases/case-00.v5.hash: -------------------------------------------------------------------------------- 1 | Z6EW6IDZJXHDMNGTVSKYLMZVG47ORYF4O6JDQXQGQFJP476SLM75FXFOYI27OJHMIX5OIHKQ6LXWLYQ5LDGEYWEXK6GQPP6JKH6SVMI= -------------------------------------------------------------------------------- /unison-src/transcripts-using-base/serialized-cases/case-01.out: -------------------------------------------------------------------------------- 1 | (6.0, 6, "abc") -------------------------------------------------------------------------------- /unison-src/transcripts-using-base/serialized-cases/case-01.v4.hash: -------------------------------------------------------------------------------- 1 | F5QWFLMAWQDYCMOPDCCTYLWJ2HOBGUG2G5YLWHSAFGDXSHGYQIWDSN6PVWC2RJXIGB7ZBSZVIJ6OENKGWAEZIV3CLQ2AWL3WKITPDXA= -------------------------------------------------------------------------------- /unison-src/transcripts-using-base/serialized-cases/case-01.v5.hash: -------------------------------------------------------------------------------- 1 | F5QWFLMAWQDYCMOPDCCTYLWJ2HOBGUG2G5YLWHSAFGDXSHGYQIWDSN6PVWC2RJXIGB7ZBSZVIJ6OENKGWAEZIV3CLQ2AWL3WKITPDXA= -------------------------------------------------------------------------------- /unison-src/transcripts-using-base/serialized-cases/case-02.out: -------------------------------------------------------------------------------- 1 | (0, 0, "0") -------------------------------------------------------------------------------- /unison-src/transcripts-using-base/serialized-cases/case-02.v4.hash: -------------------------------------------------------------------------------- 1 | OKXJPQQY4QXSCGDHM2LSUTSIKWE7W5PS6CSYCKBOEOBTRKHOKWTH6QZP7HEVWPEJC5CWGWB54ZPI7YB36F37MXN7ISPCP5JGX26NRBQ= -------------------------------------------------------------------------------- /unison-src/transcripts-using-base/serialized-cases/case-02.v5.hash: -------------------------------------------------------------------------------- 1 | OKXJPQQY4QXSCGDHM2LSUTSIKWE7W5PS6CSYCKBOEOBTRKHOKWTH6QZP7HEVWPEJC5CWGWB54ZPI7YB36F37MXN7ISPCP5JGX26NRBQ= -------------------------------------------------------------------------------- /unison-src/transcripts-using-base/serialized-cases/case-03.out: -------------------------------------------------------------------------------- 1 | (42, 31, "45") -------------------------------------------------------------------------------- /unison-src/transcripts-using-base/serialized-cases/case-03.v4.hash: -------------------------------------------------------------------------------- 1 | DLSO2TFPG5363MWC7FDSUW55VYA7P7CI4DBRFLWGPSUTF6YR45QPIPBSJPANZH44MGVYRSSMTPXODLDUFCO6JF43V3IPU4DRDU7JKII= -------------------------------------------------------------------------------- /unison-src/transcripts-using-base/serialized-cases/case-03.v5.hash: -------------------------------------------------------------------------------- 1 | DLSO2TFPG5363MWC7FDSUW55VYA7P7CI4DBRFLWGPSUTF6YR45QPIPBSJPANZH44MGVYRSSMTPXODLDUFCO6JF43V3IPU4DRDU7JKII= -------------------------------------------------------------------------------- /unison-src/transcripts-using-base/serialized-cases/case-04.out: -------------------------------------------------------------------------------- 1 | okay -------------------------------------------------------------------------------- /unison-src/transcripts-using-base/serialized-cases/case-04.v4.hash: -------------------------------------------------------------------------------- 1 | KPXQRV7VO4LIVLHVTR5HXUDOXSFFF2C4QM7IMLCU3YZXJSTJSFDT7YUZCWEW4TLH4SHAHT7NHB2ZTUUWGRGUTWGBVY7BFA33XWRBDKQ= -------------------------------------------------------------------------------- /unison-src/transcripts-using-base/serialized-cases/case-04.v5.hash: -------------------------------------------------------------------------------- 1 | EXAQLMU6IKGAY7DNOHND5VUQQAQPIJN3IVCF5DISOOEVLRQZ3Q2CZOYEVDMY7MYQX2CG6CJFH2HQD6XOMKHQNK5JUZB3G7RZQNREQRQ= -------------------------------------------------------------------------------- /unison-src/transcripts/base_release_transcript.md: -------------------------------------------------------------------------------- 1 | 2 | # Testing functions that use the base library 3 | 4 | ``` ucm 5 | scratch/main> lib.install @unison/base/releases/3.35.0 6 | ``` 7 | 8 | This just verifies that a `Map` prints out nicely, as a call to `Map.fromList`: 9 | 10 | ```unison 11 | > Map.fromList [("Alice", 1), ("Bob", 2), ("Carol", 3)] 12 | 13 | > Map.fromList (List.range 0 25 |> List.map (i -> (i,i))) 14 | ``` -------------------------------------------------------------------------------- /unison-src/transcripts/errors/code-block-parse-error.md: -------------------------------------------------------------------------------- 1 | ``` ucm 2 | foo/bar% this uses the wrong delimiter before the UCM command 3 | ``` 4 | -------------------------------------------------------------------------------- /unison-src/transcripts/errors/code-block-parse-error.output.md: -------------------------------------------------------------------------------- 1 | :2:8: 2 | | 3 | 2 | foo/bar% this uses the wrong delimiter before the UCM command 4 | | ^ 5 | unexpected '%' 6 | expecting '>' 7 | -------------------------------------------------------------------------------- /unison-src/transcripts/errors/dont-hide-unexpected-unison-errors.md: -------------------------------------------------------------------------------- 1 | Since this code block is expecting an error, we still hide it. It seems unusual to want to hide an error, but maybe it’s just too verbose or something. This follows the author’s intent. 2 | 3 | ``` unison :hide :error 4 | x + x + 5 | ``` 6 | 7 | For comparison, here is what we get without the `:hide`. 8 | 9 | ``` unison :error 10 | x + x + 11 | ``` 12 | 13 | Even though this code block has `:hide` on it, we should still see the error output, because it wasn’t expecting an error. 14 | 15 | ``` unison :hide 16 | x + x + 17 | ``` 18 | -------------------------------------------------------------------------------- /unison-src/transcripts/errors/info-string-parse-error.md: -------------------------------------------------------------------------------- 1 | ``` ucm :hode 2 | doesn’t matter that this isn’t a valid UCM command, because we should have failed to parse “hode” above 3 | ``` 4 | -------------------------------------------------------------------------------- /unison-src/transcripts/errors/info-string-parse-error.output.md: -------------------------------------------------------------------------------- 1 | :1:9: 2 | | 3 | 1 | ``` ucm :hode 4 | | ^ 5 | unexpected ':' 6 | expecting ":added-by-ucm", ":bug", ":error", ":hide", ":hide-all", or newline 7 | -------------------------------------------------------------------------------- /unison-src/transcripts/errors/invalid-api-requests.md: -------------------------------------------------------------------------------- 1 | ``` api 2 | DELETE /something/important 3 | ``` 4 | -------------------------------------------------------------------------------- /unison-src/transcripts/errors/invalid-api-requests.output.md: -------------------------------------------------------------------------------- 1 | :2:1: 2 | | 3 | 2 | DELETE /something/important 4 | | ^^^ 5 | unexpected "DEL" 6 | expecting " ", " ", "--", "GET", end of input, or newline 7 | -------------------------------------------------------------------------------- /unison-src/transcripts/errors/missing-result-typed.md: -------------------------------------------------------------------------------- 1 | ### Transcript parser hidden errors 2 | 3 | When an error is encountered in a `unison :hide-all` block 4 | then the transcript parser should print the stanza 5 | and surface a helpful message. 6 | 7 | ``` ucm :hide 8 | scratch/main> builtins.merge 9 | ``` 10 | 11 | ``` unison :hide-all 12 | a : Nat 13 | a = 14 | b = 24 15 | ``` 16 | -------------------------------------------------------------------------------- /unison-src/transcripts/errors/missing-result-typed.output.md: -------------------------------------------------------------------------------- 1 | ### Transcript parser hidden errors 2 | 3 | When an error is encountered in a `unison :hide-all` block 4 | then the transcript parser should print the stanza 5 | and surface a helpful message. 6 | 7 | ``` ucm :hide 8 | scratch/main> builtins.merge 9 | ``` 10 | 11 | ``` unison :hide-all 12 | a : Nat 13 | a = 14 | b = 24 15 | ``` 16 | 17 | 🛑 18 | 19 | The transcript failed due to an error in the stanza above. The error is: 20 | 21 | ``` 22 | The last element of a block must be an expression, but this is a 23 | definition: 24 | 25 | 3 | b = 24 26 | 27 | Try adding an expression at the end of the block. 28 | It should be of type Nat. 29 | ``` 30 | -------------------------------------------------------------------------------- /unison-src/transcripts/errors/missing-result.md: -------------------------------------------------------------------------------- 1 | ### Transcript parser hidden errors 2 | 3 | When an error is encountered in a `unison :hide-all` block 4 | then the transcript parser should print the stanza 5 | and surface a helpful message. 6 | 7 | ``` unison :hide-all 8 | x = 9 | y = 24 10 | ``` 11 | -------------------------------------------------------------------------------- /unison-src/transcripts/errors/missing-result.output.md: -------------------------------------------------------------------------------- 1 | ### Transcript parser hidden errors 2 | 3 | When an error is encountered in a `unison :hide-all` block 4 | then the transcript parser should print the stanza 5 | and surface a helpful message. 6 | 7 | ``` unison :hide-all 8 | x = 9 | y = 24 10 | ``` 11 | 12 | 🛑 13 | 14 | The transcript failed due to an error in the stanza above. The error is: 15 | 16 | ``` 17 | The last element of a block must be an expression, but this is a 18 | definition: 19 | 20 | 2 | y = 24 21 | 22 | Try adding an expression at the end of the block. 23 | ``` 24 | -------------------------------------------------------------------------------- /unison-src/transcripts/errors/no-abspath-in-ucm.md: -------------------------------------------------------------------------------- 1 | ``` ucm :error 2 | scratch/main> builtins.merge 3 | -- As of 0.5.25, we no longer allow loose code paths for UCM commands. 4 | .> ls . 5 | ``` 6 | -------------------------------------------------------------------------------- /unison-src/transcripts/errors/no-abspath-in-ucm.output.md: -------------------------------------------------------------------------------- 1 | :4:1: 2 | | 3 | 4 | .> ls . 4 | | ^^ 5 | unexpected ".>" 6 | expecting " ", " ", '@', comment (delimited with “--”), end of input, or newline 7 | -------------------------------------------------------------------------------- /unison-src/transcripts/errors/obsolete-bug.md: -------------------------------------------------------------------------------- 1 | This transcript will error, because we’re claiming that the stanza has a bug, but `help` works as expected. 2 | 3 | ``` ucm :bug 4 | scratch/main> help edit 5 | ``` 6 | -------------------------------------------------------------------------------- /unison-src/transcripts/errors/obsolete-bug.output.md: -------------------------------------------------------------------------------- 1 | This transcript will error, because we’re claiming that the stanza has a bug, but `help` works as expected. 2 | 3 | ``` ucm :bug 4 | scratch/main> help edit 5 | 6 | edit 7 | `edit foo` prepends the definition of `foo` to the top of the most recently saved file. 8 | `edit` without arguments invokes a search to select a definition for editing, which requires that `fzf` can be found within your PATH. 9 | ``` 10 | 11 | 🎉 12 | 13 | ## You fixed a bug\! 14 | 15 | The stanza above with `:bug` is now passing\! You can remove `:bug` and close any appropriate Github issues. 16 | -------------------------------------------------------------------------------- /unison-src/transcripts/errors/obsolete-error-bug.md: -------------------------------------------------------------------------------- 1 | This transcript will fail, because we’re claiming that the stanza has a bug, but `do.something` errors as expected. 2 | 3 | ``` ucm :error :bug 4 | scratch/main> do.something 5 | ``` 6 | -------------------------------------------------------------------------------- /unison-src/transcripts/errors/obsolete-error-bug.output.md: -------------------------------------------------------------------------------- 1 | This transcript will fail, because we’re claiming that the stanza has a bug, but `do.something` errors as expected. 2 | 3 | ``` ucm :error :bug 4 | scratch/main> do.something 5 | ``` 6 | 7 | 🎉 8 | 9 | ## You fixed a bug\! 10 | 11 | The stanza above marked with `:error :bug` is now failing with 12 | 13 | ``` 14 | ⚠️ 15 | I don't know how to do.something. Type `help` or `?` to get 16 | help. 17 | ``` 18 | 19 | so you can remove `:bug` and close any appropriate Github issues. If the error message is different from the expected error message, open a new issue and reference it in this transcript. 20 | -------------------------------------------------------------------------------- /unison-src/transcripts/errors/ucm-hide-all-error.md: -------------------------------------------------------------------------------- 1 | ### Transcript parser hidden errors 2 | 3 | Dangerous scary words! 4 | 5 | When an expected error is not encountered in a `ucm :hide-all` block 6 | then the transcript parser should print the stanza 7 | and surface a helpful message. 8 | 9 | ``` ucm :hide-all :error 10 | scratch/main> history 11 | ``` 12 | -------------------------------------------------------------------------------- /unison-src/transcripts/errors/ucm-hide-all-error.output.md: -------------------------------------------------------------------------------- 1 | ### Transcript parser hidden errors 2 | 3 | Dangerous scary words\! 4 | 5 | When an expected error is not encountered in a `ucm :hide-all` block 6 | then the transcript parser should print the stanza 7 | and surface a helpful message. 8 | 9 | ``` ucm :hide-all :error 10 | scratch/main> history 11 | ``` 12 | 13 | 🛑 14 | 15 | The transcript was expecting an error in the stanza above, but did not encounter one. 16 | -------------------------------------------------------------------------------- /unison-src/transcripts/errors/ucm-hide-all.md: -------------------------------------------------------------------------------- 1 | ### Transcript parser hidden errors 2 | 3 | Dangerous scary words! 4 | 5 | When an error is encountered in a `ucm :hide-all` block 6 | then the transcript parser should print the stanza 7 | and surface a helpful message. 8 | 9 | ``` ucm :hide-all 10 | scratch/main> move.namespace foo bar 11 | ``` 12 | -------------------------------------------------------------------------------- /unison-src/transcripts/errors/ucm-hide-all.output.md: -------------------------------------------------------------------------------- 1 | ### Transcript parser hidden errors 2 | 3 | Dangerous scary words\! 4 | 5 | When an error is encountered in a `ucm :hide-all` block 6 | then the transcript parser should print the stanza 7 | and surface a helpful message. 8 | 9 | ``` ucm :hide-all 10 | scratch/main> move.namespace foo bar 11 | ``` 12 | 13 | 🛑 14 | 15 | The transcript failed due to an error in the stanza above. The error is: 16 | 17 | ``` 18 | ⚠️ 19 | 20 | The namespace foo doesn't exist. 21 | ``` 22 | -------------------------------------------------------------------------------- /unison-src/transcripts/errors/ucm-hide-error.md: -------------------------------------------------------------------------------- 1 | ### Transcript parser hidden errors 2 | 3 | Dangerous scary words! 4 | 5 | When an expected error is not encountered in a `ucm :hide` block 6 | then the transcript parser should print the stanza 7 | and surface a helpful message. 8 | 9 | ``` ucm :hide:error 10 | scratch/main> history 11 | ``` 12 | -------------------------------------------------------------------------------- /unison-src/transcripts/errors/ucm-hide-error.output.md: -------------------------------------------------------------------------------- 1 | ### Transcript parser hidden errors 2 | 3 | Dangerous scary words\! 4 | 5 | When an expected error is not encountered in a `ucm :hide` block 6 | then the transcript parser should print the stanza 7 | and surface a helpful message. 8 | 9 | ``` ucm :hide :error 10 | scratch/main> history 11 | ``` 12 | 13 | 🛑 14 | 15 | The transcript was expecting an error in the stanza above, but did not encounter one. 16 | -------------------------------------------------------------------------------- /unison-src/transcripts/errors/ucm-hide.md: -------------------------------------------------------------------------------- 1 | ### Transcript parser hidden errors 2 | 3 | Dangerous scary words! 4 | 5 | When an error is encountered in a `ucm :hide` block 6 | then the transcript parser should print the stanza 7 | and surface a helpful message. 8 | 9 | ``` ucm :hide 10 | scratch/main> move.namespace foo bar 11 | ``` 12 | -------------------------------------------------------------------------------- /unison-src/transcripts/errors/ucm-hide.output.md: -------------------------------------------------------------------------------- 1 | ### Transcript parser hidden errors 2 | 3 | Dangerous scary words\! 4 | 5 | When an error is encountered in a `ucm :hide` block 6 | then the transcript parser should print the stanza 7 | and surface a helpful message. 8 | 9 | ``` ucm :hide 10 | scratch/main> move.namespace foo bar 11 | ``` 12 | 13 | 🛑 14 | 15 | The transcript failed due to an error in the stanza above. The error is: 16 | 17 | ``` 18 | ⚠️ 19 | 20 | The namespace foo doesn't exist. 21 | ``` 22 | -------------------------------------------------------------------------------- /unison-src/transcripts/errors/unison-hide-all-error.md: -------------------------------------------------------------------------------- 1 | ### Transcript parser hidden errors 2 | 3 | When an expected error is not encountered in a `unison :hide-all :error` block 4 | then the transcript parser should print the stanza 5 | and surface a helpful message. 6 | 7 | ``` unison :hide-all :error 8 | myVal = 3 9 | ``` 10 | -------------------------------------------------------------------------------- /unison-src/transcripts/errors/unison-hide-all-error.output.md: -------------------------------------------------------------------------------- 1 | ### Transcript parser hidden errors 2 | 3 | When an expected error is not encountered in a `unison :hide-all :error` block 4 | then the transcript parser should print the stanza 5 | and surface a helpful message. 6 | 7 | ``` unison :hide-all :error 8 | myVal = 3 9 | ``` 10 | 11 | 🛑 12 | 13 | The transcript was expecting an error in the stanza above, but did not encounter one. 14 | -------------------------------------------------------------------------------- /unison-src/transcripts/errors/unison-hide-all.md: -------------------------------------------------------------------------------- 1 | ### Transcript parser hidden errors 2 | 3 | When an error is encountered in a `unison :hide-all` block 4 | then the transcript parser should print the stanza 5 | and surface a helpful message. 6 | 7 | ``` unison :hide-all 8 | g 3 9 | ``` 10 | -------------------------------------------------------------------------------- /unison-src/transcripts/errors/unison-hide-error.md: -------------------------------------------------------------------------------- 1 | ### Transcript parser hidden errors 2 | 3 | When an expected error is not encountered in a `unison :hide:error` block 4 | then the transcript parser should print the stanza 5 | and surface a helpful message. 6 | 7 | ``` unison :hide:error 8 | myVal = 3 9 | ``` 10 | -------------------------------------------------------------------------------- /unison-src/transcripts/errors/unison-hide-error.output.md: -------------------------------------------------------------------------------- 1 | ### Transcript parser hidden errors 2 | 3 | When an expected error is not encountered in a `unison :hide:error` block 4 | then the transcript parser should print the stanza 5 | and surface a helpful message. 6 | 7 | ``` unison :hide :error 8 | myVal = 3 9 | ``` 10 | 11 | 🛑 12 | 13 | The transcript was expecting an error in the stanza above, but did not encounter one. 14 | -------------------------------------------------------------------------------- /unison-src/transcripts/errors/unison-hide.md: -------------------------------------------------------------------------------- 1 | ### Transcript parser hidden errors 2 | 3 | When an error is encountered in a `unison :hide` block 4 | then the transcript parser should print the stanza 5 | and surface a helpful message. 6 | 7 | ``` unison :hide 8 | g 3 9 | ``` 10 | -------------------------------------------------------------------------------- /unison-src/transcripts/idempotent/ability-order-doesnt-affect-hash.md: -------------------------------------------------------------------------------- 1 | The order of a set of abilities is normalized before hashing. 2 | 3 | ``` unison :hide 4 | unique ability Foo where 5 | foo : () 6 | 7 | unique ability Bar where 8 | bar : () 9 | 10 | term1 : () ->{Foo, Bar} () 11 | term1 _ = () 12 | 13 | term2 : () ->{Bar, Foo} () 14 | term2 _ = () 15 | ``` 16 | 17 | ``` ucm 18 | scratch/main> add 19 | 20 | Okay, I'm searching the branch for code that needs to be 21 | updated... 22 | 23 | Done. 24 | 25 | scratch/main> names term1 26 | 27 | 'term1': 28 | Hash Kind Names 29 | #42m1ui9g56 Term term1, term2 30 | ``` 31 | -------------------------------------------------------------------------------- /unison-src/transcripts/idempotent/add-test-watch-roundtrip.md: -------------------------------------------------------------------------------- 1 | ``` ucm :hide 2 | scratch/main> builtins.mergeio 3 | ``` 4 | 5 | ``` unison :hide 6 | test> foo : [Test.Result] 7 | foo = [] 8 | ``` 9 | 10 | Apparently when we add a test watch, we add a type annotation to it, even if it already has one. We don't want this to happen though\! 11 | 12 | ``` ucm 13 | scratch/main> add 14 | 15 | Okay, I'm searching the branch for code that needs to be 16 | updated... 17 | 18 | Done. 19 | 20 | scratch/main> view foo 21 | 22 | foo : [Result] 23 | foo : [Result] 24 | foo = [] 25 | ``` 26 | -------------------------------------------------------------------------------- /unison-src/transcripts/idempotent/any-extract.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /unison-src/transcripts/idempotent/bug-fix-4354.md: -------------------------------------------------------------------------------- 1 | ``` ucm :hide 2 | scratch/main> builtins.merge 3 | ``` 4 | 5 | ``` unison 6 | bonk : forall a. a -> a 7 | bonk x = 8 | zonk : forall a. a -> a 9 | zonk z = z 10 | honk : a 11 | honk = x 12 | x 13 | ``` 14 | 15 | ``` ucm :added-by-ucm 16 | Loading changes detected in scratch.u. 17 | 18 | I found and typechecked these definitions in scratch.u. If you 19 | do an `update`, here's how your codebase would change: 20 | 21 | ⍟ These new definitions are ok to `update`: 22 | 23 | bonk : a -> a 24 | ``` 25 | -------------------------------------------------------------------------------- /unison-src/transcripts/idempotent/bug.md: -------------------------------------------------------------------------------- 1 | This tests that `:bug` behaves similarly to `:error` when the stanza fails. 2 | 3 | ``` ucm :bug 4 | scratch/main> do.something 5 | 6 | ⚠️ 7 | I don't know how to do.something. Type `help` or `?` to get 8 | help. 9 | ``` 10 | 11 | And when combined with `:error`, it should expect a successful result. 12 | 13 | ``` ucm :error :bug 14 | scratch/main> help edit 15 | 16 | edit 17 | `edit foo` prepends the definition of `foo` to the top of the most recently saved file. 18 | `edit` without arguments invokes a search to select a definition for editing, which requires that `fzf` can be found within your PATH. 19 | ``` 20 | -------------------------------------------------------------------------------- /unison-src/transcripts/idempotent/bytesFromList.md: -------------------------------------------------------------------------------- 1 | ``` ucm :hide 2 | scratch/main> builtins.merge 3 | ``` 4 | 5 | This should render as `Bytes.fromList [1,2,3,4]`, not `##Bytes.fromSequence [1,2,3,4]`: 6 | 7 | ``` unison 8 | > Bytes.fromList [1,2,3,4] 9 | ``` 10 | 11 | ``` ucm :added-by-ucm 12 | Loading changes detected in scratch.u. 13 | 14 | ✅ 15 | 16 | scratch.u changed. 17 | 18 | Now evaluating any watch expressions (lines starting with 19 | `>`)... Ctrl+C cancels. 20 | 21 | 1 | > Bytes.fromList [1,2,3,4] 22 | ⧩ 23 | 0xs01020304 24 | ``` 25 | -------------------------------------------------------------------------------- /unison-src/transcripts/idempotent/contrabilities.md: -------------------------------------------------------------------------------- 1 | ``` ucm :hide 2 | scratch/main> builtins.merge 3 | ``` 4 | 5 | ``` unison 6 | f : (() -> a) -> Nat 7 | f x = 42 8 | ``` 9 | 10 | ``` ucm :added-by-ucm 11 | Loading changes detected in scratch.u. 12 | 13 | I found and typechecked these definitions in scratch.u. If you 14 | do an `update`, here's how your codebase would change: 15 | 16 | ⍟ These new definitions are ok to `update`: 17 | 18 | f : '{g} a -> Nat 19 | ``` 20 | -------------------------------------------------------------------------------- /unison-src/transcripts/idempotent/create-author.md: -------------------------------------------------------------------------------- 1 | ``` ucm :hide 2 | scratch/main> builtins.mergeio 3 | ``` 4 | 5 | Demonstrating `create.author`: 6 | 7 | ``` ucm 8 | scratch/main> create.author alicecoder "Alice McGee" 9 | 10 | Added definitions: 11 | 12 | 1. metadata.authors.alicecoder : Author 13 | 2. metadata.copyrightHolders.alicecoder : CopyrightHolder 14 | 3. metadata.authors.alicecoder.guid : GUID 15 | 16 | Tip: Add License values for alicecoder under metadata. 17 | 18 | scratch/main> find alicecoder 19 | 20 | 1. metadata.authors.alicecoder : Author 21 | 2. metadata.copyrightHolders.alicecoder : CopyrightHolder 22 | 3. metadata.authors.alicecoder.guid : GUID 23 | ``` 24 | -------------------------------------------------------------------------------- /unison-src/transcripts/idempotent/delete-silent.md: -------------------------------------------------------------------------------- 1 | ``` ucm :error 2 | scratch/main> delete foo 3 | 4 | ⚠️ 5 | 6 | The following names were not found in the codebase. Check your spelling. 7 | foo 8 | ``` 9 | 10 | ``` unison :hide 11 | foo = 1 12 | structural type Foo = Foo () 13 | ``` 14 | 15 | ``` ucm 16 | scratch/main> add 17 | 18 | Okay, I'm searching the branch for code that needs to be 19 | updated... 20 | 21 | Done. 22 | 23 | scratch/main> delete foo 24 | 25 | Done. 26 | 27 | scratch/main> delete.type Foo 28 | 29 | Done. 30 | 31 | scratch/main> delete.term Foo.Foo 32 | 33 | Done. 34 | ``` 35 | -------------------------------------------------------------------------------- /unison-src/transcripts/idempotent/escape-sequences.md: -------------------------------------------------------------------------------- 1 | ``` unison 2 | > "Rúnar" 3 | > "῎Ανδρα μοι ἔννεπε, Μοῦσα, πολύτροπον" 4 | > "古池や蛙飛びこむ水の音" 5 | ``` 6 | 7 | ``` ucm :added-by-ucm 8 | Loading changes detected in scratch.u. 9 | 10 | ✅ 11 | 12 | scratch.u changed. 13 | 14 | Now evaluating any watch expressions (lines starting with 15 | `>`)... Ctrl+C cancels. 16 | 17 | 1 | > "Rúnar" 18 | ⧩ 19 | "Rúnar" 20 | 21 | 2 | > "῎Ανδρα μοι ἔννεπε, Μοῦσα, πολύτροπον" 22 | ⧩ 23 | "῎Ανδρα μοι ἔννεπε, Μοῦσα, πολύτροπον" 24 | 25 | 3 | > "古池や蛙飛びこむ水の音" 26 | ⧩ 27 | "古池や蛙飛びこむ水の音" 28 | ``` 29 | -------------------------------------------------------------------------------- /unison-src/transcripts/idempotent/fix-5320.md: -------------------------------------------------------------------------------- 1 | ``` ucm 2 | scratch/main> builtins.merge lib.builtin 3 | 4 | Done. 5 | ``` 6 | 7 | ``` unison :error 8 | foo = cases 9 | bar.Baz -> 5 10 | ``` 11 | 12 | ``` ucm :added-by-ucm 13 | Loading changes detected in scratch.u. 14 | 15 | 16 | ❓ 17 | 18 | I couldn't resolve any of these symbols: 19 | 20 | 2 | bar.Baz -> 5 21 | 22 | 23 | Symbol Suggestions 24 | 25 | bar.Baz No matches 26 | ``` 27 | -------------------------------------------------------------------------------- /unison-src/transcripts/idempotent/fix1421.md: -------------------------------------------------------------------------------- 1 | ``` ucm 2 | scratch/main> alias.type ##Nat Nat 3 | 4 | Done. 5 | 6 | scratch/main> alias.term ##Nat.+ Nat.+ 7 | 8 | Done. 9 | ``` 10 | 11 | ``` unison 12 | unique type A = A Nat 13 | unique type B = B Nat Nat 14 | ``` 15 | 16 | ``` ucm :added-by-ucm 17 | Loading changes detected in scratch.u. 18 | 19 | I found and typechecked these definitions in scratch.u. If you 20 | do an `update`, here's how your codebase would change: 21 | 22 | ⍟ These new definitions are ok to `update`: 23 | 24 | type A 25 | type B 26 | ``` 27 | -------------------------------------------------------------------------------- /unison-src/transcripts/idempotent/fix2053.md: -------------------------------------------------------------------------------- 1 | ``` ucm :hide 2 | scratch/main> builtins.mergeio 3 | ``` 4 | 5 | ``` ucm 6 | scratch/main> display List.map 7 | 8 | f a -> 9 | let 10 | use Nat + 11 | go i as acc = match List.at i as with 12 | None -> acc 13 | Some a -> go (i + 1) as (acc :+ f a) 14 | go 0 a [] 15 | ``` 16 | -------------------------------------------------------------------------------- /unison-src/transcripts/idempotent/fix2187.md: -------------------------------------------------------------------------------- 1 | ``` ucm :hide 2 | scratch/main> builtins.merge 3 | ``` 4 | 5 | ``` unison 6 | 7 | lexicalScopeEx: [Text] 8 | lexicalScopeEx = 9 | parent = "outer" 10 | inner1 = let 11 | child1 = "child1" 12 | inner2 : [Text] 13 | inner2 = let 14 | child2 = "child2" 15 | [parent, child1, child2] 16 | inner2 17 | inner1 18 | 19 | ``` 20 | 21 | ``` ucm :added-by-ucm 22 | Loading changes detected in scratch.u. 23 | 24 | I found and typechecked these definitions in scratch.u. If you 25 | do an `update`, here's how your codebase would change: 26 | 27 | ⍟ These new definitions are ok to `update`: 28 | 29 | lexicalScopeEx : [Text] 30 | ``` 31 | -------------------------------------------------------------------------------- /unison-src/transcripts/idempotent/fix2244.md: -------------------------------------------------------------------------------- 1 | ``` ucm :hide 2 | scratch/main> builtins.mergeio 3 | ``` 4 | 5 | Ensure closing token is emitted by closing brace in doc eval block. 6 | 7 | ```` unison 8 | x = {{ 9 | 10 | ``` 11 | let 12 | x = 1 13 | y = 2 14 | x + y 15 | ``` 16 | 17 | }} 18 | ```` 19 | 20 | ``` ucm :added-by-ucm 21 | Loading changes detected in scratch.u. 22 | 23 | I found and typechecked these definitions in scratch.u. If you 24 | do an `update`, here's how your codebase would change: 25 | 26 | ⍟ These new definitions are ok to `update`: 27 | 28 | x : Doc2 29 | ``` 30 | 31 | ``` ucm :hide 32 | scratch/main> add 33 | ``` 34 | -------------------------------------------------------------------------------- /unison-src/transcripts/idempotent/fix2354.md: -------------------------------------------------------------------------------- 1 | ``` ucm :hide 2 | scratch/main> builtins.merge 3 | ``` 4 | 5 | Tests that delaying an un-annotated higher-rank type gives a normal 6 | type error, rather than an internal compiler error. 7 | 8 | ``` unison :error 9 | f : (forall a . a -> a) -> Nat 10 | f id = id 0 11 | 12 | x = 'f 13 | ``` 14 | 15 | ``` ucm :added-by-ucm 16 | Loading changes detected in scratch.u. 17 | 18 | I found a value of type: (a1 ->{𝕖} a1) ->{𝕖} Nat 19 | where I expected to find: (a -> 𝕣1) -> 𝕣 20 | 21 | 1 | f : (forall a . a -> a) -> Nat 22 | 2 | f id = id 0 23 | 3 | 24 | 4 | x = 'f 25 | 26 | from right here: 27 | 28 | 1 | f : (forall a . a -> a) -> Nat 29 | ``` 30 | -------------------------------------------------------------------------------- /unison-src/transcripts/idempotent/fix2628.md: -------------------------------------------------------------------------------- 1 | ``` ucm :hide 2 | scratch/main> alias.type ##Nat lib.base.Nat 3 | ``` 4 | 5 | ``` unison :hide 6 | unique type foo.bar.baz.MyRecord = { 7 | value : Nat 8 | } 9 | ``` 10 | 11 | ``` ucm 12 | scratch/main> add 13 | 14 | Okay, I'm searching the branch for code that needs to be 15 | updated... 16 | 17 | Done. 18 | 19 | scratch/main> find : Nat -> MyRecord 20 | 21 | 1. foo.bar.baz.MyRecord.MyRecord : Nat -> MyRecord 22 | ``` 23 | -------------------------------------------------------------------------------- /unison-src/transcripts/idempotent/fix2970.md: -------------------------------------------------------------------------------- 1 | Also fixes \#1519 (it's the same issue). 2 | 3 | ``` ucm 4 | scratch/main> builtins.merge 5 | 6 | Done. 7 | ``` 8 | 9 | ``` unison 10 | foo.+.doc : Nat 11 | foo.+.doc = 10 12 | ``` 13 | 14 | ``` ucm :added-by-ucm 15 | Loading changes detected in scratch.u. 16 | 17 | I found and typechecked these definitions in scratch.u. If you 18 | do an `update`, here's how your codebase would change: 19 | 20 | ⍟ These new definitions are ok to `update`: 21 | 22 | foo.+.doc : Nat 23 | ``` 24 | -------------------------------------------------------------------------------- /unison-src/transcripts/idempotent/fix3752.md: -------------------------------------------------------------------------------- 1 | ``` ucm :hide 2 | scratch/main> builtins.merge 3 | ``` 4 | 5 | These were failing to type check before, because id was not 6 | generalized. 7 | 8 | ``` unison 9 | 10 | foo = do 11 | id x = 12 | _ = 1 13 | x 14 | id () 15 | id "hello" 16 | 17 | bar = do 18 | id x = x 19 | id () 20 | id "hello" 21 | ``` 22 | 23 | ``` ucm :added-by-ucm 24 | Loading changes detected in scratch.u. 25 | 26 | I found and typechecked these definitions in scratch.u. If you 27 | do an `update`, here's how your codebase would change: 28 | 29 | ⍟ These new definitions are ok to `update`: 30 | 31 | bar : 'Text 32 | foo : 'Text 33 | ``` 34 | -------------------------------------------------------------------------------- /unison-src/transcripts/idempotent/fix3773.md: -------------------------------------------------------------------------------- 1 | ``` ucm :hide 2 | scratch/main> builtins.merge 3 | ``` 4 | 5 | ``` unison 6 | foo = 7 | _ = 1 8 | _ = 22 9 | 42 10 | 11 | > foo + 20 12 | ``` 13 | 14 | ``` ucm :added-by-ucm 15 | Loading changes detected in scratch.u. 16 | 17 | I found and typechecked these definitions in scratch.u. If you 18 | do an `update`, here's how your codebase would change: 19 | 20 | ⍟ These new definitions are ok to `update`: 21 | 22 | foo : Nat 23 | 24 | Now evaluating any watch expressions (lines starting with 25 | `>`)... Ctrl+C cancels. 26 | 27 | 6 | > foo + 20 28 | ⧩ 29 | 62 30 | ``` 31 | -------------------------------------------------------------------------------- /unison-src/transcripts/idempotent/fix4280.md: -------------------------------------------------------------------------------- 1 | ``` ucm :hide 2 | scratch/main> builtins.merge 3 | ``` 4 | 5 | ``` unison 6 | foo.bar._baz = 5 7 | 8 | bonk : Nat 9 | bonk = 10 | use foo.bar _baz 11 | _baz 12 | ``` 13 | 14 | ``` ucm :added-by-ucm 15 | Loading changes detected in scratch.u. 16 | 17 | I found and typechecked these definitions in scratch.u. If you 18 | do an `update`, here's how your codebase would change: 19 | 20 | ⍟ These new definitions are ok to `update`: 21 | 22 | bonk : Nat 23 | foo.bar._baz : Nat 24 | ``` 25 | -------------------------------------------------------------------------------- /unison-src/transcripts/idempotent/fix4397.md: -------------------------------------------------------------------------------- 1 | ``` unison :error 2 | structural type Foo f 3 | = Foo (f ()) 4 | unique type Baz = Baz (Foo Bar) 5 | 6 | unique type Bar 7 | = Bar Baz 8 | ``` 9 | 10 | ``` ucm :added-by-ucm 11 | Loading changes detected in scratch.u. 12 | 13 | Kind mismatch arising from 14 | 3 | unique type Baz = Baz (Foo Bar) 15 | 16 | Foo expects an argument of kind: Type -> Type; however, it 17 | is applied to Bar which has kind: Type. 18 | ``` 19 | -------------------------------------------------------------------------------- /unison-src/transcripts/idempotent/fix4415.md: -------------------------------------------------------------------------------- 1 | ``` unison 2 | unique type Foo = Foo 3 | unique type sub.Foo = 4 | ``` 5 | 6 | ``` ucm :added-by-ucm 7 | Loading changes detected in scratch.u. 8 | 9 | I found and typechecked these definitions in scratch.u. If you 10 | do an `update`, here's how your codebase would change: 11 | 12 | ⍟ These new definitions are ok to `update`: 13 | 14 | type Foo 15 | type sub.Foo 16 | ``` 17 | -------------------------------------------------------------------------------- /unison-src/transcripts/idempotent/fix4528.md: -------------------------------------------------------------------------------- 1 | ``` ucm :hide 2 | foo/main> builtins.merge 3 | ``` 4 | 5 | ``` unison 6 | structural type Foo = MkFoo Nat 7 | 8 | main : () -> Foo 9 | main _ = MkFoo 5 10 | ``` 11 | 12 | ``` ucm :added-by-ucm 13 | Loading changes detected in scratch.u. 14 | 15 | I found and typechecked these definitions in scratch.u. If you 16 | do an `update`, here's how your codebase would change: 17 | 18 | ⍟ These new definitions are ok to `update`: 19 | 20 | structural type Foo 21 | main : 'Foo 22 | ``` 23 | 24 | ``` ucm 25 | foo/main> add 26 | 27 | Okay, I'm searching the branch for code that needs to be 28 | updated... 29 | 30 | Done. 31 | 32 | foo/main> run main 33 | 34 | MkFoo 5 35 | ``` 36 | -------------------------------------------------------------------------------- /unison-src/transcripts/idempotent/fix4592.md: -------------------------------------------------------------------------------- 1 | ``` ucm :hide 2 | scratch/main> builtins.mergeio 3 | ``` 4 | 5 | ``` unison 6 | doc = {{ {{ bug "bug" 7 | 52 }} }} 8 | ``` 9 | 10 | ``` ucm :added-by-ucm 11 | Loading changes detected in scratch.u. 12 | 13 | I found and typechecked these definitions in scratch.u. If you 14 | do an `update`, here's how your codebase would change: 15 | 16 | ⍟ These new definitions are ok to `update`: 17 | 18 | doc : Doc2 19 | ``` 20 | -------------------------------------------------------------------------------- /unison-src/transcripts/idempotent/fix4780.md: -------------------------------------------------------------------------------- 1 | ``` ucm :hide 2 | scratch/main> builtins.merge 3 | ``` 4 | 5 | Just a simple test case to see whether partially applied 6 | builtins decompile properly. 7 | 8 | ``` unison 9 | > (+) 2 10 | ``` 11 | 12 | ``` ucm :added-by-ucm 13 | Loading changes detected in scratch.u. 14 | 15 | ✅ 16 | 17 | scratch.u changed. 18 | 19 | Now evaluating any watch expressions (lines starting with 20 | `>`)... Ctrl+C cancels. 21 | 22 | 1 | > (+) 2 23 | ⧩ 24 | (Nat.+) 2 25 | ``` 26 | -------------------------------------------------------------------------------- /unison-src/transcripts/idempotent/fix5076.md: -------------------------------------------------------------------------------- 1 | ``` ucm :hide 2 | scratch/main> builtins.mergeio 3 | ``` 4 | 5 | Nested call to code lexer wasn’t terminating inline examples containing blocks properly. 6 | 7 | ``` unison 8 | x = {{ 9 | ``let "me"`` live 10 | ``do "me"`` in 11 | }} 12 | ``` 13 | 14 | ``` ucm :added-by-ucm 15 | Loading changes detected in scratch.u. 16 | 17 | I found and typechecked these definitions in scratch.u. If you 18 | do an `update`, here's how your codebase would change: 19 | 20 | ⍟ These new definitions are ok to `update`: 21 | 22 | x : Doc2 23 | ``` 24 | -------------------------------------------------------------------------------- /unison-src/transcripts/idempotent/fix5141.md: -------------------------------------------------------------------------------- 1 | 6 | -------------------------------------------------------------------------------- /unison-src/transcripts/idempotent/fix5168.md: -------------------------------------------------------------------------------- 1 | The `edit` seems to suppress a following ` ``` unison ` block: 2 | 3 | ``` unison 4 | b = 2 5 | ``` 6 | 7 | ``` ucm :added-by-ucm 8 | Loading changes detected in scratch.u. 9 | 10 | I found and typechecked these definitions in scratch.u. If you 11 | do an `update`, here's how your codebase would change: 12 | 13 | ⍟ These new definitions are ok to `update`: 14 | 15 | b : ##Nat 16 | ``` 17 | -------------------------------------------------------------------------------- /unison-src/transcripts/idempotent/fix5337.md: -------------------------------------------------------------------------------- 1 | ``` ucm 2 | scratch/main> builtins.mergeio 3 | 4 | Done. 5 | ``` 6 | 7 | The following `Doc` fails to typecheck with `ucm` `0.5.26`: 8 | 9 | ``` unison :bug 10 | testDoc : Doc2 11 | testDoc = {{ 12 | key: '{{ docWord "value" }}'. 13 | }} 14 | ``` 15 | 16 | ``` ucm :added-by-ucm 17 | Loading changes detected in scratch.u. 18 | 19 | I got confused here: 20 | 21 | 3 | key: '{{ docWord "value" }}'. 22 | 23 | 24 | I was surprised to find a . here. 25 | I was expecting one of these instead: 26 | 27 | * end of input 28 | ``` 29 | 30 | The same code typechecks ok with `0.5.25`. 31 | -------------------------------------------------------------------------------- /unison-src/transcripts/idempotent/fix5448.md: -------------------------------------------------------------------------------- 1 | ``` unison :hide 2 | type NewType = NewType 3 | main = do NewType 4 | ``` 5 | 6 | You shouldn't have to `update` a type before using it with `run`. 7 | 8 | ``` ucm 9 | scratch/main> run main 10 | 11 | NewType 12 | ``` 13 | -------------------------------------------------------------------------------- /unison-src/transcripts/idempotent/fix689.md: -------------------------------------------------------------------------------- 1 | Tests the fix for https://github.com/unisonweb/unison/issues/689 2 | 3 | ``` ucm :hide 4 | scratch/main> builtins.merge 5 | ``` 6 | 7 | ``` unison 8 | structural ability SystemTime where 9 | systemTime : ##Nat 10 | 11 | tomorrow = '(SystemTime.systemTime + 24 * 60 * 60) 12 | ``` 13 | 14 | ``` ucm :added-by-ucm 15 | Loading changes detected in scratch.u. 16 | 17 | I found and typechecked these definitions in scratch.u. If you 18 | do an `update`, here's how your codebase would change: 19 | 20 | ⍟ These new definitions are ok to `update`: 21 | 22 | structural ability SystemTime 23 | tomorrow : '{SystemTime} Nat 24 | ``` 25 | -------------------------------------------------------------------------------- /unison-src/transcripts/idempotent/fix849.md: -------------------------------------------------------------------------------- 1 | ``` ucm :hide 2 | scratch/main> builtins.merge 3 | ``` 4 | 5 | See [this ticket](https://github.com/unisonweb/unison/issues/849). 6 | 7 | ``` unison 8 | x = 42 9 | 10 | > x 11 | ``` 12 | 13 | ``` ucm :added-by-ucm 14 | Loading changes detected in scratch.u. 15 | 16 | I found and typechecked these definitions in scratch.u. If you 17 | do an `update`, here's how your codebase would change: 18 | 19 | ⍟ These new definitions are ok to `update`: 20 | 21 | x : Nat 22 | 23 | Now evaluating any watch expressions (lines starting with 24 | `>`)... Ctrl+C cancels. 25 | 26 | 3 | > x 27 | ⧩ 28 | 42 29 | ``` 30 | -------------------------------------------------------------------------------- /unison-src/transcripts/idempotent/old-fold-right.md: -------------------------------------------------------------------------------- 1 | ``` ucm :hide 2 | scratch/main> builtins.merge 3 | ``` 4 | 5 | ``` unison 6 | oldRight: (b ->{e} a ->{e} b) -> [a] ->{e} [b] 7 | oldRight f la = bug "out" 8 | 9 | pecan: '{} [Text] 10 | pecan = 'let 11 | la = [1, 2, 3] 12 | f: Text -> Nat -> Text 13 | f = bug "out" 14 | 15 | oldRight f la 16 | ``` 17 | 18 | ``` ucm :added-by-ucm 19 | Loading changes detected in scratch.u. 20 | 21 | I found and typechecked these definitions in scratch.u. If you 22 | do an `update`, here's how your codebase would change: 23 | 24 | ⍟ These new definitions are ok to `update`: 25 | 26 | oldRight : (b ->{e} a ->{e} b) -> [a] ->{e} [b] 27 | pecan : '[Text] 28 | ``` 29 | -------------------------------------------------------------------------------- /unison-src/transcripts/idempotent/unitnamespace.md: -------------------------------------------------------------------------------- 1 | ``` unison 2 | `()`.foo = "bar" 3 | ``` 4 | 5 | ``` ucm :added-by-ucm 6 | Loading changes detected in scratch.u. 7 | 8 | I found and typechecked these definitions in scratch.u. If you 9 | do an `update`, here's how your codebase would change: 10 | 11 | ⍟ These new definitions are ok to `update`: 12 | 13 | `()`.foo : ##Text 14 | ``` 15 | 16 | ``` ucm 17 | scratch/main> add 18 | 19 | Okay, I'm searching the branch for code that needs to be 20 | updated... 21 | 22 | Done. 23 | 24 | scratch/main> find 25 | 26 | 1. `()`.foo : ##Text 27 | 28 | scratch/main> find-in `()` 29 | 30 | 1. foo : ##Text 31 | 32 | scratch/main> delete.namespace `()` 33 | 34 | Done. 35 | ``` 36 | -------------------------------------------------------------------------------- /unison-src/transcripts/idempotent/update-watch.md: -------------------------------------------------------------------------------- 1 | ``` unison 2 | > 1 3 | ``` 4 | 5 | ``` ucm :added-by-ucm 6 | Loading changes detected in scratch.u. 7 | 8 | ✅ 9 | 10 | scratch.u changed. 11 | 12 | Now evaluating any watch expressions (lines starting with 13 | `>`)... Ctrl+C cancels. 14 | 15 | 1 | > 1 16 | ⧩ 17 | 1 18 | ``` 19 | 20 | ``` ucm 21 | scratch/main> update 22 | 23 | Okay, I'm searching the branch for code that needs to be 24 | updated... 25 | 26 | Done. 27 | ``` 28 | -------------------------------------------------------------------------------- /unison-src/transcripts/no-hash-in-term-declaration.md: -------------------------------------------------------------------------------- 1 | # No Hashes in Term Declarations 2 | 3 | There should not be hashes in the names used in term declarations, either in the type signature or the type definition. 4 | 5 | ``` unison :hide-all :error 6 | x##Nat : Int -> Int -> Boolean 7 | x##Nat = 5 8 | ``` 9 | -------------------------------------------------------------------------------- /unison-src/transcripts/no-hash-in-term-declaration.output.md: -------------------------------------------------------------------------------- 1 | # No Hashes in Term Declarations 2 | 3 | There should not be hashes in the names used in term declarations, either in the type signature or the type definition. 4 | -------------------------------------------------------------------------------- /unison-src/transcripts/pretty-print-libraries.md: -------------------------------------------------------------------------------- 1 | This transcript is to detect changes in the pretty-printer for a few major public libraries. 2 | 3 | We clone releases and not dev branches to avoid external changes, and also to reduce the time needed to clone the libraries. 4 | 5 | ```ucm 6 | scratch/main> clone @unison/base/releases/3.19.0 7 | @unison/base/releases/3.19.0> edit.namespace . 8 | ``` 9 | 10 | ```ucm 11 | scratch/main> clone @unison/http/releases/3.3.2 12 | @unison/http/releases/3.3.2> edit.namespace . 13 | ``` 14 | -------------------------------------------------------------------------------- /unison-src/transcripts/project-outputs/docs/publishing.output.md: -------------------------------------------------------------------------------- 1 | # Publishing Unison code 2 | 3 | Thinking about a design for publishing Unison code revealed a nest of interrelated concerns: 4 | 5 | - [Using library code in my application & sharing my application as a library](publishing-library1.md) 6 | - [Updating my library & sharing an updated library](publishing-library2.md) 7 | 8 | 9 | 10 | Each of these linked subtopics presents concerns, questions, and ideas, which we can weigh and collect into [our M1 proposal](publishing-M1.md). 11 | -------------------------------------------------------------------------------- /unison-syntax/src/Unison/Lexer/Pos.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE BangPatterns #-} 2 | {-# LANGUAGE DeriveFoldable #-} 3 | {-# LANGUAGE DeriveTraversable #-} 4 | {-# LANGUAGE TemplateHaskell #-} 5 | {-# LANGUAGE ViewPatterns #-} 6 | 7 | module Unison.Lexer.Pos (Pos (..), Line, Column) where 8 | 9 | type Line = Int 10 | 11 | type Column = Int 12 | 13 | data Pos = Pos {line :: {-# UNPACK #-} !Line, column :: {-# UNPACK #-} !Column} deriving (Show, Eq, Ord) 14 | 15 | instance Semigroup Pos where 16 | Pos line col <> Pos line2 col2 = 17 | if line2 == 0 18 | then Pos line (col + col2) 19 | else Pos (line + line2) col2 20 | 21 | instance Monoid Pos where 22 | mempty = Pos 0 0 23 | -------------------------------------------------------------------------------- /unison-syntax/src/Unison/Syntax/Var.hs: -------------------------------------------------------------------------------- 1 | module Unison.Syntax.Var 2 | ( namespaced, 3 | namespaced2, 4 | ) 5 | where 6 | 7 | import Data.List.NonEmpty (pattern (:|)) 8 | import Data.List.NonEmpty qualified as List (NonEmpty) 9 | import Unison.Name qualified as Name 10 | import Unison.Prelude 11 | import Unison.Syntax.Name qualified as Name 12 | import Unison.Var (Var) 13 | 14 | namespaced :: (Var v) => List.NonEmpty v -> v 15 | namespaced (v :| vs) = 16 | Name.toVar (foldl' Name.joinDot (Name.unsafeParseVar v) (map Name.unsafeParseVar vs)) 17 | 18 | -- | Like 'namespaced', but for the common case that you have two vars to join. 19 | namespaced2 :: (Var v) => v -> v -> v 20 | namespaced2 v1 v2 = 21 | namespaced (v1 :| [v2]) 22 | -------------------------------------------------------------------------------- /unison-syntax/src/Unison/UnisonFile/Error.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE OverloadedStrings #-} 2 | {-# LANGUAGE PatternSynonyms #-} 3 | {-# LANGUAGE RecordWildCards #-} 4 | {-# LANGUAGE ViewPatterns #-} 5 | 6 | module Unison.UnisonFile.Error where 7 | 8 | data Error v a 9 | = -- A free type variable that couldn't be resolved 10 | UnknownType v a 11 | | -- A variable which is both a data and an ability declaration 12 | DupDataAndAbility v a a 13 | deriving (Eq, Ord, Show) 14 | -------------------------------------------------------------------------------- /unison-syntax/test/Main.hs: -------------------------------------------------------------------------------- 1 | module Main (main) where 2 | 3 | import EasyTest 4 | import System.Environment (getArgs) 5 | import System.IO 6 | import System.IO.CodePage (withCP65001) 7 | import Unison.Test.Doc qualified as Doc 8 | import Unison.Test.Unison qualified as Unison 9 | 10 | test :: Test () 11 | test = 12 | tests 13 | [ Doc.test, 14 | Unison.test 15 | ] 16 | 17 | main :: IO () 18 | main = withCP65001 do 19 | args <- getArgs 20 | mapM_ (`hSetEncoding` utf8) [stdout, stdin, stderr] 21 | case args of 22 | [] -> runOnly "" test 23 | [prefix] -> runOnly prefix test 24 | [seed, prefix] -> rerunOnly (read seed) prefix test 25 | _ -> error "expected no args, a prefix, or a seed and a prefix" 26 | -------------------------------------------------------------------------------- /weeder.dhall: -------------------------------------------------------------------------------- 1 | { roots = [ "^Main.main$", "^Paths_.*" ], type-class-roots = True } 2 | --------------------------------------------------------------------------------