├── .gitignore
├── .travis.yml
├── CONTRIBUTING.md
├── CONTRIBUTORS.md
├── INSTALL.md
├── LICENSE
├── Makefile
├── README.md
├── RELEASE_CHECKLIST.md
├── Setup.hs
├── app
├── Command
│ ├── Bundle.hs
│ ├── Compile.hs
│ ├── Docs.hs
│ ├── Docs
│ │ ├── Html.hs
│ │ └── Markdown.hs
│ ├── Hierarchy.hs
│ ├── Ide.hs
│ ├── Publish.hs
│ └── REPL.hs
├── Main.hs
├── Version.hs
└── static
│ ├── index.html
│ ├── index.js
│ ├── normalize.css
│ ├── pursuit.css
│ └── pursuit.less
├── bundle
├── .gitignore
├── README
└── build.sh
├── ci
├── build.sh
├── convert-os-name.sh
└── disable-windows-defender.sh
├── core-tests
├── .gitignore
├── psc-package.json
├── test-everything.sh
└── tests
│ ├── GenericDeriving.purs
│ └── Main.purs
├── license-generator
├── generate.hs
└── header.txt
├── logo.png
├── make_release_notes
├── npm-package
├── .gitignore
├── LICENSE
├── README.md
├── index.js
├── package.json
└── purs.bin.placeholder
├── package.yaml
├── psc-ide
├── DESIGN.org
├── PROTOCOL.md
└── README.md
├── src
├── Control
│ └── Monad
│ │ ├── Logger.hs
│ │ ├── Supply.hs
│ │ └── Supply
│ │ └── Class.hs
├── Language
│ ├── PureScript.hs
│ └── PureScript
│ │ ├── AST.hs
│ │ ├── AST
│ │ ├── Binders.hs
│ │ ├── Declarations.hs
│ │ ├── Exported.hs
│ │ ├── Literals.hs
│ │ ├── Operators.hs
│ │ ├── SourcePos.hs
│ │ └── Traversals.hs
│ │ ├── Bundle.hs
│ │ ├── CST.hs
│ │ ├── CST
│ │ ├── Convert.hs
│ │ ├── Errors.hs
│ │ ├── Layout.hs
│ │ ├── Lexer.hs
│ │ ├── Monad.hs
│ │ ├── Parser.y
│ │ ├── Positions.hs
│ │ ├── Print.hs
│ │ ├── Traversals.hs
│ │ ├── Traversals
│ │ │ └── Type.hs
│ │ ├── Types.hs
│ │ └── Utils.hs
│ │ ├── CodeGen.hs
│ │ ├── CodeGen
│ │ ├── Erl.hs
│ │ ├── Erl
│ │ │ ├── AST.hs
│ │ │ ├── Common.hs
│ │ │ ├── Constants.hs
│ │ │ ├── Optimizer.hs
│ │ │ └── Optimizer
│ │ │ │ ├── Blocks.hs
│ │ │ │ ├── Common.hs
│ │ │ │ ├── Guards.hs
│ │ │ │ ├── Inliner.hs
│ │ │ │ └── MagicDo.hs
│ │ ├── JS.hs
│ │ └── JS
│ │ │ ├── Common.hs
│ │ │ └── Printer.hs
│ │ ├── Comments.hs
│ │ ├── Constants.hs
│ │ ├── CoreFn.hs
│ │ ├── CoreFn
│ │ ├── Ann.hs
│ │ ├── Binders.hs
│ │ ├── Desugar.hs
│ │ ├── Expr.hs
│ │ ├── FromJSON.hs
│ │ ├── Meta.hs
│ │ ├── Module.hs
│ │ ├── Optimizer.hs
│ │ ├── ToJSON.hs
│ │ └── Traversals.hs
│ │ ├── CoreImp.hs
│ │ ├── CoreImp
│ │ ├── AST.hs
│ │ ├── Optimizer.hs
│ │ └── Optimizer
│ │ │ ├── Blocks.hs
│ │ │ ├── Common.hs
│ │ │ ├── Inliner.hs
│ │ │ ├── MagicDo.hs
│ │ │ ├── TCO.hs
│ │ │ └── Unused.hs
│ │ ├── Crash.hs
│ │ ├── Docs.hs
│ │ ├── Docs
│ │ ├── AsHtml.hs
│ │ ├── AsMarkdown.hs
│ │ ├── Collect.hs
│ │ ├── Convert.hs
│ │ ├── Convert
│ │ │ ├── ReExports.hs
│ │ │ └── Single.hs
│ │ ├── Css.hs
│ │ ├── Prim.hs
│ │ ├── Render.hs
│ │ ├── RenderedCode.hs
│ │ ├── RenderedCode
│ │ │ ├── RenderKind.hs
│ │ │ ├── RenderType.hs
│ │ │ └── Types.hs
│ │ ├── Tags.hs
│ │ ├── Types.hs
│ │ └── Utils
│ │ │ └── MonoidExtras.hs
│ │ ├── Environment.hs
│ │ ├── Errors.hs
│ │ ├── Errors
│ │ └── JSON.hs
│ │ ├── Externs.hs
│ │ ├── Hierarchy.hs
│ │ ├── Ide.hs
│ │ ├── Ide
│ │ ├── CaseSplit.hs
│ │ ├── Command.hs
│ │ ├── Completion.hs
│ │ ├── Error.hs
│ │ ├── Externs.hs
│ │ ├── Filter.hs
│ │ ├── Filter
│ │ │ └── Declaration.hs
│ │ ├── Imports.hs
│ │ ├── Logging.hs
│ │ ├── Matcher.hs
│ │ ├── Prim.hs
│ │ ├── Rebuild.hs
│ │ ├── Reexports.hs
│ │ ├── SourceFile.hs
│ │ ├── State.hs
│ │ ├── Types.hs
│ │ ├── Usage.hs
│ │ ├── Util.hs
│ │ └── Watcher.hs
│ │ ├── Interactive.hs
│ │ ├── Interactive
│ │ ├── Completion.hs
│ │ ├── Directive.hs
│ │ ├── IO.hs
│ │ ├── Message.hs
│ │ ├── Module.hs
│ │ ├── Parser.hs
│ │ ├── Printer.hs
│ │ └── Types.hs
│ │ ├── Kinds.hs
│ │ ├── Label.hs
│ │ ├── Linter.hs
│ │ ├── Linter
│ │ ├── Exhaustive.hs
│ │ └── Imports.hs
│ │ ├── Make.hs
│ │ ├── Make
│ │ ├── Actions.hs
│ │ ├── BuildPlan.hs
│ │ ├── Cache.hs
│ │ └── Monad.hs
│ │ ├── ModuleDependencies.hs
│ │ ├── Names.hs
│ │ ├── Options.hs
│ │ ├── PSString.hs
│ │ ├── Parser
│ │ └── Erl.hs
│ │ ├── Pretty.hs
│ │ ├── Pretty
│ │ ├── Common.hs
│ │ ├── Erl.hs
│ │ ├── Kinds.hs
│ │ ├── Types.hs
│ │ └── Values.hs
│ │ ├── Publish.hs
│ │ ├── Publish
│ │ ├── BoxesHelpers.hs
│ │ ├── ErrorsWarnings.hs
│ │ └── Utils.hs
│ │ ├── Renamer.hs
│ │ ├── Sugar.hs
│ │ ├── Sugar
│ │ ├── AdoNotation.hs
│ │ ├── BindingGroups.hs
│ │ ├── CaseDeclarations.hs
│ │ ├── DoNotation.hs
│ │ ├── LetPattern.hs
│ │ ├── Names.hs
│ │ ├── Names
│ │ │ ├── Common.hs
│ │ │ ├── Env.hs
│ │ │ ├── Exports.hs
│ │ │ └── Imports.hs
│ │ ├── ObjectWildcards.hs
│ │ ├── Operators.hs
│ │ ├── Operators
│ │ │ ├── Binders.hs
│ │ │ ├── Common.hs
│ │ │ ├── Expr.hs
│ │ │ └── Types.hs
│ │ ├── TypeClasses.hs
│ │ ├── TypeClasses
│ │ │ └── Deriving.hs
│ │ └── TypeDeclarations.hs
│ │ ├── Traversals.hs
│ │ ├── TypeChecker.hs
│ │ ├── TypeChecker
│ │ ├── Entailment.hs
│ │ ├── Kinds.hs
│ │ ├── Monad.hs
│ │ ├── Skolems.hs
│ │ ├── Subsumption.hs
│ │ ├── Synonyms.hs
│ │ ├── TypeSearch.hs
│ │ ├── Types.hs
│ │ └── Unify.hs
│ │ ├── TypeClassDictionaries.hs
│ │ └── Types.hs
└── System
│ └── IO
│ └── UTF8.hs
├── stack.yaml
└── tests
├── Language
└── PureScript
│ └── Ide
│ ├── CompletionSpec.hs
│ ├── FilterSpec.hs
│ ├── ImportsSpec.hs
│ ├── MatcherSpec.hs
│ ├── RebuildSpec.hs
│ ├── ReexportsSpec.hs
│ ├── SourceFileSpec.hs
│ ├── StateSpec.hs
│ ├── Test.hs
│ └── UsageSpec.hs
├── Main.hs
├── PscIdeSpec.hs
├── TestBundle.hs
├── TestCompiler.hs
├── TestCoreFn.hs
├── TestCst.hs
├── TestDocs.hs
├── TestHierarchy.hs
├── TestIde.hs
├── TestMake.hs
├── TestPrimDocs.hs
├── TestPscPublish.hs
├── TestPsci.hs
├── TestPsci
├── CommandTest.hs
├── CompletionTest.hs
├── EvalTest.hs
└── TestEnv.hs
├── TestUtils.hs
├── json-compat
├── v0.11.3
│ ├── generics-4.0.0.json
│ └── symbols-3.0.0.json
└── v0.12.1
│ └── typelevel-prelude-3.0.0.json
├── purs
├── .gitignore
├── bundle
│ ├── 3551
│ │ ├── ModuleWithDeadCode.js
│ │ └── ModuleWithDeadCode.purs
│ ├── 3551.purs
│ ├── 3727.js
│ ├── 3727.purs
│ ├── ObjectShorthand.js
│ ├── ObjectShorthand.purs
│ ├── PSasConstructor.purs
│ └── RerunCompilerTests.txt
├── docs
│ ├── bower.json
│ ├── bower_components
│ │ ├── purescript-newtype
│ │ │ └── src
│ │ │ │ └── Data
│ │ │ │ └── Newtype.purs
│ │ └── purescript-prelude
│ │ │ └── src
│ │ │ └── Prelude.purs
│ ├── resolutions.json
│ └── src
│ │ ├── Ado.purs
│ │ ├── ChildDeclOrder.purs
│ │ ├── Clash.purs
│ │ ├── Clash1.purs
│ │ ├── Clash1a.purs
│ │ ├── Clash2.purs
│ │ ├── Clash2a.purs
│ │ ├── ConstrainedArgument.purs
│ │ ├── DeclOrder.purs
│ │ ├── DeclOrderNoExportList.purs
│ │ ├── Desugar.purs
│ │ ├── DocComments.purs
│ │ ├── DocCommentsClassMethod.purs
│ │ ├── DocCommentsDataConstructor.purs
│ │ ├── DuplicateNames.purs
│ │ ├── Example.purs
│ │ ├── Example2.purs
│ │ ├── ExplicitExport.purs
│ │ ├── ExplicitTypeSignatures.purs
│ │ ├── ImportedTwice.purs
│ │ ├── ImportedTwiceA.purs
│ │ ├── ImportedTwiceB.purs
│ │ ├── MultiVirtual.purs
│ │ ├── MultiVirtual1.purs
│ │ ├── MultiVirtual2.purs
│ │ ├── MultiVirtual3.purs
│ │ ├── NewOperators.purs
│ │ ├── NewOperators2.purs
│ │ ├── NotAllCtors.purs
│ │ ├── PrimSubmodules.purs
│ │ ├── ReExportedTypeClass.purs
│ │ ├── SolitaryTypeClassMember.purs
│ │ ├── SomeTypeClass.purs
│ │ ├── Transitive1.purs
│ │ ├── Transitive2.purs
│ │ ├── Transitive3.purs
│ │ ├── TypeClassWithFunDeps.purs
│ │ ├── TypeClassWithoutMembers.purs
│ │ ├── TypeClassWithoutMembersIntermediate.purs
│ │ ├── TypeLevelString.purs
│ │ ├── TypeOpAliases.purs
│ │ ├── TypeSynonym.purs
│ │ ├── TypeSynonymInstance.purs
│ │ ├── UTF8.purs
│ │ └── Virtual.purs
├── failing
│ ├── 1733
│ │ └── Thingy.purs
│ ├── 2378
│ │ └── Lib.purs
│ ├── 2379
│ │ └── Lib.purs
│ ├── 1071.purs
│ ├── 1169.purs
│ ├── 1175.purs
│ ├── 1310.purs
│ ├── 1570.purs
│ ├── 1733.purs
│ ├── 1825.purs
│ ├── 1881.purs
│ ├── 2128-class.purs
│ ├── 2128-instance.purs
│ ├── 2197-shouldFail.purs
│ ├── 2197-shouldFail2.purs
│ ├── 2378.purs
│ ├── 2379.purs
│ ├── 2434.purs
│ ├── 2534.purs
│ ├── 2542.purs
│ ├── 2567.purs
│ ├── 2601.purs
│ ├── 2616.purs
│ ├── 2806.purs
│ ├── 2874-forall.purs
│ ├── 2874-forall2.purs
│ ├── 2874-wildcard.purs
│ ├── 2947.purs
│ ├── 3132.purs
│ ├── 3275-BindingGroupErrorPos.purs
│ ├── 3275-DataBindingGroupErrorPos.purs
│ ├── 3335-TypeOpAssociativityError.purs
│ ├── 3405.purs
│ ├── 3549-a.purs
│ ├── 3549.purs
│ ├── 365.purs
│ ├── 3689.purs
│ ├── 438.purs
│ ├── 881.purs
│ ├── AnonArgument1.purs
│ ├── AnonArgument2.purs
│ ├── AnonArgument3.purs
│ ├── ApostropheModuleName.purs
│ ├── ArgLengthMismatch.purs
│ ├── ArrayType.purs
│ ├── Arrays.purs
│ ├── AtPatternPrecedence.purs
│ ├── BindInDo-2.purs
│ ├── BindInDo.purs
│ ├── CannotDeriveNewtypeForData.purs
│ ├── CaseBinderLengthsDiffer.purs
│ ├── CaseDoesNotMatchAllConstructorArgs.purs
│ ├── ConflictingExports.purs
│ ├── ConflictingExports
│ │ ├── A.purs
│ │ └── B.purs
│ ├── ConflictingImports.purs
│ ├── ConflictingImports
│ │ ├── A.purs
│ │ └── B.purs
│ ├── ConflictingImports2.purs
│ ├── ConflictingImports2
│ │ ├── A.purs
│ │ └── B.purs
│ ├── ConflictingQualifiedImports.purs
│ ├── ConflictingQualifiedImports
│ │ ├── A.purs
│ │ └── B.purs
│ ├── ConflictingQualifiedImports2.purs
│ ├── ConflictingQualifiedImports2
│ │ ├── A.purs
│ │ └── B.purs
│ ├── ConstraintFailure.purs
│ ├── ConstraintInference.purs
│ ├── DctorOperatorAliasExport.purs
│ ├── DeclConflictClassCtor.purs
│ ├── DeclConflictClassSynonym.purs
│ ├── DeclConflictClassType.purs
│ ├── DeclConflictCtorClass.purs
│ ├── DeclConflictCtorCtor.purs
│ ├── DeclConflictDuplicateCtor.purs
│ ├── DeclConflictSynonymClass.purs
│ ├── DeclConflictSynonymType.purs
│ ├── DeclConflictTypeClass.purs
│ ├── DeclConflictTypeSynonym.purs
│ ├── DeclConflictTypeType.purs
│ ├── DiffKindsSameName.purs
│ ├── DiffKindsSameName
│ │ ├── LibA.purs
│ │ └── LibB.purs
│ ├── Do.purs
│ ├── DoNotSuggestComposition.purs
│ ├── DoNotSuggestComposition2.purs
│ ├── DuplicateDeclarationsInLet.purs
│ ├── DuplicateInstance.purs
│ ├── DuplicateModule.purs
│ ├── DuplicateModule
│ │ └── M1.purs
│ ├── DuplicateProperties.purs
│ ├── DuplicateTypeClass.purs
│ ├── DuplicateTypeVars.purs
│ ├── EmptyCase.purs
│ ├── EmptyClass.purs
│ ├── EmptyDo.purs
│ ├── ExpectedWildcard.purs
│ ├── ExportConflictClass.purs
│ ├── ExportConflictClass
│ │ ├── A.purs
│ │ └── B.purs
│ ├── ExportConflictClassAndType.purs
│ ├── ExportConflictClassAndType
│ │ ├── A.purs
│ │ └── B.purs
│ ├── ExportConflictCtor.purs
│ ├── ExportConflictCtor
│ │ ├── A.purs
│ │ └── B.purs
│ ├── ExportConflictType.purs
│ ├── ExportConflictType
│ │ ├── A.purs
│ │ └── B.purs
│ ├── ExportConflictTypeOp.purs
│ ├── ExportConflictTypeOp
│ │ ├── A.purs
│ │ └── B.purs
│ ├── ExportConflictValue.purs
│ ├── ExportConflictValue
│ │ ├── A.purs
│ │ └── B.purs
│ ├── ExportConflictValueOp.purs
│ ├── ExportConflictValueOp
│ │ ├── A.purs
│ │ └── B.purs
│ ├── ExportExplicit.purs
│ ├── ExportExplicit1.purs
│ ├── ExportExplicit1
│ │ └── M1.purs
│ ├── ExportExplicit2.purs
│ ├── ExportExplicit3.purs
│ ├── ExportExplicit3
│ │ └── M1.purs
│ ├── ExtraRecordField.purs
│ ├── ExtraneousClassMember.purs
│ ├── Foldable.purs
│ ├── Generalization1.purs
│ ├── Generalization2.purs
│ ├── ImportExplicit.purs
│ ├── ImportExplicit
│ │ └── M1.purs
│ ├── ImportExplicit2.purs
│ ├── ImportExplicit2
│ │ └── M1.purs
│ ├── ImportHidingModule.purs
│ ├── ImportHidingModule
│ │ ├── A.purs
│ │ └── B.purs
│ ├── ImportModule.purs
│ ├── ImportModule
│ │ └── M2.purs
│ ├── InfiniteKind.purs
│ ├── InfiniteKind2.purs
│ ├── InfiniteType.purs
│ ├── InstanceChainBothUnknownAndMatch.purs
│ ├── InstanceChainSkolemUnknownMatch.purs
│ ├── InstanceExport.purs
│ ├── InstanceExport
│ │ └── InstanceExport.purs
│ ├── InstanceSigsBodyIncorrect.purs
│ ├── InstanceSigsDifferentTypes.purs
│ ├── InstanceSigsIncorrectType.purs
│ ├── InstanceSigsOrphanTypeDeclaration.purs
│ ├── IntOutOfRange.purs
│ ├── InvalidDerivedInstance.purs
│ ├── InvalidDerivedInstance2.purs
│ ├── InvalidOperatorInBinder.purs
│ ├── KindError.purs
│ ├── KindStar.purs
│ ├── LacksWithSubGoal.purs
│ ├── LeadingZeros1.purs
│ ├── LeadingZeros2.purs
│ ├── Let.purs
│ ├── LetPatterns1.purs
│ ├── LetPatterns2.purs
│ ├── LetPatterns3.purs
│ ├── LetPatterns4.purs
│ ├── MPTCs.purs
│ ├── MissingClassExport.purs
│ ├── MissingClassMember.purs
│ ├── MissingClassMemberExport.purs
│ ├── MissingFFIImplementations.js
│ ├── MissingFFIImplementations.purs
│ ├── MissingRecordField.purs
│ ├── MixedAssociativityError.purs
│ ├── MultipleErrors.purs
│ ├── MultipleErrors2.purs
│ ├── MultipleTypeOpFixities.purs
│ ├── MultipleValueOpFixities.purs
│ ├── MutRec.purs
│ ├── MutRec2.purs
│ ├── NewtypeInstance.purs
│ ├── NewtypeInstance2.purs
│ ├── NewtypeInstance3.purs
│ ├── NewtypeInstance4.purs
│ ├── NewtypeInstance5.purs
│ ├── NewtypeInstance6.purs
│ ├── NewtypeMultiArgs.purs
│ ├── NewtypeMultiCtor.purs
│ ├── NonAssociativeError.purs
│ ├── NonExhaustivePatGuard.purs
│ ├── NullaryAbs.purs
│ ├── Object.purs
│ ├── OperatorAliasNoExport.purs
│ ├── OperatorAt.purs
│ ├── OperatorBackslash.purs
│ ├── OperatorSections.purs
│ ├── OrphanInstance.purs
│ ├── OrphanInstance
│ │ └── Class.purs
│ ├── OrphanInstanceFunDepCycle.purs
│ ├── OrphanInstanceFunDepCycle
│ │ └── Lib.purs
│ ├── OrphanInstanceNullary.purs
│ ├── OrphanInstanceNullary
│ │ └── Lib.purs
│ ├── OrphanInstanceWithDetermined.purs
│ ├── OrphanInstanceWithDetermined
│ │ └── Lib.purs
│ ├── OrphanTypeDecl.purs
│ ├── OverlapAcrossModules.purs
│ ├── OverlapAcrossModules
│ │ ├── Class.purs
│ │ └── X.purs
│ ├── OverlappingArguments.purs
│ ├── OverlappingBinders.purs
│ ├── OverlappingInstances.purs
│ ├── OverlappingVars.purs
│ ├── PrimModuleReserved.purs
│ ├── PrimModuleReserved
│ │ └── Prim.purs
│ ├── PrimRow.purs
│ ├── PrimSubModuleReserved.purs
│ ├── PrimSubModuleReserved
│ │ └── Prim_Foobar.purs
│ ├── ProgrammableTypeErrors.purs
│ ├── ProgrammableTypeErrorsTypeString.purs
│ ├── Rank2Types.purs
│ ├── RequiredHiddenType.purs
│ ├── Reserved.purs
│ ├── RowConstructors1.purs
│ ├── RowConstructors2.purs
│ ├── RowConstructors3.purs
│ ├── RowInInstanceNotDetermined0.purs
│ ├── RowInInstanceNotDetermined1.purs
│ ├── RowInInstanceNotDetermined2.purs
│ ├── RowLacks.purs
│ ├── SelfImport.purs
│ ├── SelfImport
│ │ └── Dummy.purs
│ ├── SkolemEscape.purs
│ ├── SkolemEscape2.purs
│ ├── SuggestComposition.purs
│ ├── Superclasses1.purs
│ ├── Superclasses2.purs
│ ├── Superclasses3.purs
│ ├── Superclasses5.purs
│ ├── TooFewClassInstanceArgs.purs
│ ├── TopLevelCaseNoArgs.purs
│ ├── TransitiveDctorExport.purs
│ ├── TransitiveKindExport.purs
│ ├── TransitiveSynonymExport.purs
│ ├── TypeClasses2.purs
│ ├── TypeError.purs
│ ├── TypeOperatorAliasNoExport.purs
│ ├── TypeSynonyms.purs
│ ├── TypeSynonyms2.purs
│ ├── TypeSynonyms3.purs
│ ├── TypeSynonyms4.purs
│ ├── TypeSynonyms5.purs
│ ├── TypeWildcards1.purs
│ ├── TypeWildcards2.purs
│ ├── TypeWildcards3.purs
│ ├── TypedBinders.purs
│ ├── TypedBinders2.purs
│ ├── TypedBinders3.purs
│ ├── TypedHole.purs
│ ├── TypedHole2.purs
│ ├── UnderscoreModuleName.purs
│ ├── UnknownType.purs
│ ├── UnusableTypeClassMethod.purs
│ ├── UnusableTypeClassMethodConflictingIdent.purs
│ ├── UnusableTypeClassMethodSynonym.purs
│ └── Whitespace1.purs
├── layout
│ ├── .gitattributes
│ ├── AdoIn.out
│ ├── AdoIn.purs
│ ├── CaseGuards.out
│ ├── CaseGuards.purs
│ ├── CaseWhere.out
│ ├── CaseWhere.purs
│ ├── ClassHead.out
│ ├── ClassHead.purs
│ ├── Commas.out
│ ├── Commas.purs
│ ├── Delimiter.out
│ ├── Delimiter.purs
│ ├── DoLet.out
│ ├── DoLet.purs
│ ├── DoOperator.out
│ ├── DoOperator.purs
│ ├── DoWhere.out
│ ├── DoWhere.purs
│ ├── IfThenElseDo.out
│ ├── IfThenElseDo.purs
│ ├── InstanceChainElse.out
│ ├── InstanceChainElse.purs
│ ├── LetGuards.out
│ └── LetGuards.purs
├── passing
│ ├── 2018
│ │ ├── A.purs
│ │ └── B.purs
│ ├── 2138
│ │ └── Lib.purs
│ ├── 2609
│ │ └── Eg.purs
│ ├── 3114
│ │ └── VendoredVariant.purs
│ ├── 1110.purs
│ ├── 1185.purs
│ ├── 1335.purs
│ ├── 1570.purs
│ ├── 1664.purs
│ ├── 1697.purs
│ ├── 1807.purs
│ ├── 1881.purs
│ ├── 1991.purs
│ ├── 2018.purs
│ ├── 2049.purs
│ ├── 2136.purs
│ ├── 2138.purs
│ ├── 2172.js
│ ├── 2172.purs
│ ├── 2197-1.purs
│ ├── 2197-2.purs
│ ├── 2252.purs
│ ├── 2288.purs
│ ├── 2378.purs
│ ├── 2438.purs
│ ├── 2609.purs
│ ├── 2616.purs
│ ├── 2626.purs
│ ├── 2663.purs
│ ├── 2689.purs
│ ├── 2756.purs
│ ├── 2787.purs
│ ├── 2795.purs
│ ├── 2803.purs
│ ├── 2806.purs
│ ├── 2947.purs
│ ├── 2958.purs
│ ├── 2972.purs
│ ├── 3114.purs
│ ├── 3125.purs
│ ├── 3187-UnusedNameClash.purs
│ ├── 3388.purs
│ ├── 3410.purs
│ ├── 3481.purs
│ ├── 3549.purs
│ ├── 3558-UpToDateDictsForHigherOrderFns.purs
│ ├── 3595.purs
│ ├── 652.purs
│ ├── 810.purs
│ ├── 862.purs
│ ├── 922.purs
│ ├── Ado.purs
│ ├── AppendInReverse.purs
│ ├── Applicative.purs
│ ├── ArrayType.purs
│ ├── Auto.purs
│ ├── AutoPrelude.purs
│ ├── AutoPrelude2.purs
│ ├── BindersInFunctions.purs
│ ├── BindingGroups.purs
│ ├── BlockString.purs
│ ├── CaseInDo.purs
│ ├── CaseInputWildcard.purs
│ ├── CaseMultipleExpressions.purs
│ ├── CaseStatement.purs
│ ├── CheckFunction.purs
│ ├── CheckSynonymBug.purs
│ ├── CheckTypeClass.purs
│ ├── Church.purs
│ ├── ClassRefSyntax.purs
│ ├── ClassRefSyntax
│ │ └── Lib.purs
│ ├── Collatz.purs
│ ├── Comparisons.purs
│ ├── Conditional.purs
│ ├── Console.purs
│ ├── ConstraintInference.purs
│ ├── ConstraintOutsideForall.purs
│ ├── ConstraintParens.purs
│ ├── ConstraintParsingIssue.purs
│ ├── ContextSimplification.purs
│ ├── DataAndType.purs
│ ├── DataConsClassConsOverlapOk.purs
│ ├── DctorName.purs
│ ├── DctorOperatorAlias.purs
│ ├── DctorOperatorAlias
│ │ └── List.purs
│ ├── DeepArrayBinder.purs
│ ├── DeepCase.purs
│ ├── DeriveNewtype.purs
│ ├── DeriveWithNestedSynonyms.purs
│ ├── Deriving.purs
│ ├── DerivingFunctor.purs
│ ├── Do.purs
│ ├── Dollar.purs
│ ├── DuplicateProperties.purs
│ ├── EffFn.js
│ ├── EffFn.purs
│ ├── EmptyDataDecls.purs
│ ├── EmptyDicts.purs
│ ├── EmptyRow.purs
│ ├── EmptyTypeClass.purs
│ ├── EntailsKindedType.purs
│ ├── Eq1Deriving.purs
│ ├── Eq1InEqDeriving.purs
│ ├── EqOrd.purs
│ ├── ExplicitImportReExport.purs
│ ├── ExplicitImportReExport
│ │ ├── Bar.purs
│ │ └── Foo.purs
│ ├── ExplicitOperatorSections.purs
│ ├── ExportExplicit.purs
│ ├── ExportExplicit
│ │ └── M1.purs
│ ├── ExportExplicit2.purs
│ ├── ExportExplicit2
│ │ └── M1.purs
│ ├── ExportedInstanceDeclarations.purs
│ ├── ExtendedInfixOperators.purs
│ ├── Fib.purs
│ ├── FieldConsPuns.purs
│ ├── FieldPuns.purs
│ ├── FinalTagless.purs
│ ├── ForeignKind.purs
│ ├── ForeignKind
│ │ └── Lib.purs
│ ├── FunWithFunDeps.js
│ ├── FunWithFunDeps.purs
│ ├── FunctionAndCaseGuards.purs
│ ├── FunctionScope.purs
│ ├── FunctionalDependencies.purs
│ ├── Functions.purs
│ ├── Functions2.purs
│ ├── Generalization1.purs
│ ├── GenericsRep.purs
│ ├── Guards.purs
│ ├── HasOwnProperty.purs
│ ├── HoistError.purs
│ ├── IfThenElseMaybe.purs
│ ├── IfWildcard.purs
│ ├── ImplicitEmptyImport.purs
│ ├── Import.purs
│ ├── Import
│ │ ├── M1.purs
│ │ └── M2.purs
│ ├── ImportExplicit.purs
│ ├── ImportExplicit
│ │ └── M1.purs
│ ├── ImportHiding.purs
│ ├── ImportQualified.purs
│ ├── ImportQualified
│ │ └── M1.purs
│ ├── InferRecFunWithConstrainedArgument.purs
│ ├── InheritMultipleSuperClasses.purs
│ ├── InstanceBeforeClass.purs
│ ├── InstanceChain.purs
│ ├── InstanceSigs.purs
│ ├── InstanceSigsGeneral.purs
│ ├── IntAndChar.purs
│ ├── JSReserved.purs
│ ├── KindedType.purs
│ ├── LargeSumType.purs
│ ├── Let.purs
│ ├── Let2.purs
│ ├── LetInInstance.purs
│ ├── LetPattern.purs
│ ├── LiberalTypeSynonyms.purs
│ ├── MPTCs.purs
│ ├── Match.purs
│ ├── Module.purs
│ ├── Module
│ │ ├── M1.purs
│ │ └── M2.purs
│ ├── ModuleDeps.purs
│ ├── ModuleDeps
│ │ ├── M1.purs
│ │ ├── M2.purs
│ │ └── M3.purs
│ ├── ModuleExport.purs
│ ├── ModuleExport
│ │ └── A.purs
│ ├── ModuleExportDupes.purs
│ ├── ModuleExportDupes
│ │ ├── A.purs
│ │ ├── B.purs
│ │ └── C.purs
│ ├── ModuleExportExcluded.purs
│ ├── ModuleExportExcluded
│ │ └── A.purs
│ ├── ModuleExportQualified.purs
│ ├── ModuleExportQualified
│ │ └── A.purs
│ ├── ModuleExportSelf.purs
│ ├── ModuleExportSelf
│ │ └── A.purs
│ ├── Monad.purs
│ ├── MonadState.purs
│ ├── MultiArgFunctions.purs
│ ├── MutRec.purs
│ ├── MutRec2.purs
│ ├── MutRec3.purs
│ ├── NakedConstraint.purs
│ ├── NamedPatterns.purs
│ ├── NegativeBinder.purs
│ ├── NegativeIntInRange.purs
│ ├── Nested.purs
│ ├── NestedRecordUpdate.purs
│ ├── NestedRecordUpdateWildcards.purs
│ ├── NestedTypeSynonyms.purs
│ ├── NestedWhere.purs
│ ├── NewConsClass.purs
│ ├── Newtype.purs
│ ├── NewtypeClass.purs
│ ├── NewtypeEff.purs
│ ├── NewtypeInstance.purs
│ ├── NewtypeWithRecordUpdate.purs
│ ├── NonConflictingExports.purs
│ ├── NonConflictingExports
│ │ └── A.purs
│ ├── NonOrphanInstanceFunDepExtra.purs
│ ├── NonOrphanInstanceFunDepExtra
│ │ └── Lib.purs
│ ├── NonOrphanInstanceMulti.purs
│ ├── NonOrphanInstanceMulti
│ │ └── Lib.purs
│ ├── NumberLiterals.purs
│ ├── ObjectGetter.purs
│ ├── ObjectSynonym.purs
│ ├── ObjectUpdate.purs
│ ├── ObjectUpdate2.purs
│ ├── ObjectUpdater.purs
│ ├── ObjectWildcards.purs
│ ├── Objects.purs
│ ├── OneConstructor.purs
│ ├── OperatorAlias.purs
│ ├── OperatorAliasElsewhere.purs
│ ├── OperatorAliasElsewhere
│ │ └── Def.purs
│ ├── OperatorAssociativity.purs
│ ├── OperatorInlining.purs
│ ├── OperatorSections.purs
│ ├── Operators.purs
│ ├── Operators
│ │ └── Other.purs
│ ├── OptimizerBug.purs
│ ├── OptionalQualified.purs
│ ├── Ord1Deriving.purs
│ ├── Ord1InOrdDeriving.purs
│ ├── ParensInType.purs
│ ├── ParensInTypedBinder.purs
│ ├── PartialFunction.purs
│ ├── PartialTCO.purs
│ ├── Patterns.purs
│ ├── PendingConflictingImports.purs
│ ├── PendingConflictingImports
│ │ ├── A.purs
│ │ └── B.purs
│ ├── PendingConflictingImports2.purs
│ ├── PendingConflictingImports2
│ │ └── A.purs
│ ├── Person.purs
│ ├── PolyLabels.js
│ ├── PolyLabels.purs
│ ├── PrimedTypeName.purs
│ ├── QualifiedAdo.purs
│ ├── QualifiedAdo
│ │ └── IxApplicative.purs
│ ├── QualifiedDo.purs
│ ├── QualifiedDo
│ │ └── IxMonad.purs
│ ├── QualifiedNames.purs
│ ├── QualifiedNames
│ │ └── Either.purs
│ ├── QualifiedQualifiedImports.purs
│ ├── Rank2Data.purs
│ ├── Rank2Object.purs
│ ├── Rank2TypeSynonym.purs
│ ├── Rank2Types.purs
│ ├── ReExportQualified.purs
│ ├── ReExportQualified
│ │ ├── A.purs
│ │ ├── B.purs
│ │ └── C.purs
│ ├── RebindableSyntax.purs
│ ├── Recursion.purs
│ ├── RedefinedFixity.purs
│ ├── RedefinedFixity
│ │ ├── M1.purs
│ │ ├── M2.purs
│ │ └── M3.purs
│ ├── ReservedWords.purs
│ ├── ResolvableScopeConflict.purs
│ ├── ResolvableScopeConflict
│ │ ├── A.purs
│ │ └── B.purs
│ ├── ResolvableScopeConflict2.purs
│ ├── ResolvableScopeConflict2
│ │ └── A.purs
│ ├── ResolvableScopeConflict3.purs
│ ├── ResolvableScopeConflict3
│ │ └── A.purs
│ ├── RowConstructors.purs
│ ├── RowInInstanceHeadDetermined.purs
│ ├── RowLacks.purs
│ ├── RowNub.purs
│ ├── RowPolyInstanceContext.purs
│ ├── RowUnion.js
│ ├── RowUnion.purs
│ ├── RowsInInstanceContext.purs
│ ├── RunFnInline.purs
│ ├── RuntimeScopeIssue.purs
│ ├── ScopedTypeVariables.purs
│ ├── Sequence.purs
│ ├── SequenceDesugared.purs
│ ├── ShadowedModuleName.purs
│ ├── ShadowedModuleName
│ │ └── Test.purs
│ ├── ShadowedName.purs
│ ├── ShadowedRename.purs
│ ├── ShadowedTCO.purs
│ ├── ShadowedTCOLet.purs
│ ├── SignedNumericLiterals.purs
│ ├── SolvingAppendSymbol.purs
│ ├── SolvingCompareSymbol.purs
│ ├── SolvingIsSymbol.purs
│ ├── SolvingIsSymbol
│ │ └── Lib.purs
│ ├── Stream.purs
│ ├── StringEdgeCases.purs
│ ├── StringEdgeCases
│ │ ├── Records.purs
│ │ └── Symbols.purs
│ ├── StringEscapes.purs
│ ├── Superclasses1.purs
│ ├── Superclasses3.purs
│ ├── TCO.purs
│ ├── TCOCase.purs
│ ├── TailCall.purs
│ ├── Tick.purs
│ ├── TopLevelCase.purs
│ ├── TransitiveImport.purs
│ ├── TransitiveImport
│ │ ├── Middle.purs
│ │ └── Test.purs
│ ├── TypeAnnotationPrecedence.purs
│ ├── TypeClassMemberOrderChange.purs
│ ├── TypeClasses.purs
│ ├── TypeClassesInOrder.purs
│ ├── TypeClassesWithOverlappingTypeVariables.purs
│ ├── TypeDecl.purs
│ ├── TypeOperators.purs
│ ├── TypeOperators
│ │ └── A.purs
│ ├── TypeSynonymInData.purs
│ ├── TypeSynonyms.purs
│ ├── TypeWildcards.purs
│ ├── TypeWildcardsRecordExtension.purs
│ ├── TypeWithoutParens.purs
│ ├── TypeWithoutParens
│ │ └── Lib.purs
│ ├── TypedBinders.purs
│ ├── TypedWhere.purs
│ ├── UTF8Sourcefile.purs
│ ├── UnderscoreIdent.purs
│ ├── UnicodeIdentifier.purs
│ ├── UnicodeOperators.purs
│ ├── UnicodeType.purs
│ ├── UnifyInTypeInstanceLookup.purs
│ ├── Unit.purs
│ ├── UnknownInTypeClassLookup.purs
│ ├── UnsafeCoerce.purs
│ ├── UntupledConstraints.purs
│ ├── UsableTypeClassMethods.purs
│ ├── Where.purs
│ ├── WildcardInInstance.purs
│ ├── WildcardType.purs
│ ├── iota.purs
│ └── s.purs
├── psci
│ ├── BasicEval.purs
│ └── Multiline.purs
├── publish
│ └── basic-example
│ │ ├── README.md
│ │ ├── bower.json
│ │ ├── resolutions-legacy.json
│ │ ├── resolutions.json
│ │ └── src
│ │ └── Main.purs
└── warning
│ ├── 2140.purs
│ ├── 2383.purs
│ ├── 2411.purs
│ ├── 2542.purs
│ ├── CustomWarning.purs
│ ├── CustomWarning2.purs
│ ├── CustomWarning3.purs
│ ├── CustomWarning4.purs
│ ├── DuplicateExportRef.purs
│ ├── DuplicateImport.purs
│ ├── DuplicateImportRef.purs
│ ├── DuplicateSelectiveImport.purs
│ ├── HidingImport.purs
│ ├── ImplicitImport.purs
│ ├── ImplicitQualifiedImport.purs
│ ├── ImplicitQualifiedImportReExport.purs
│ ├── Kind-UnusedExplicitImport-1.purs
│ ├── Kind-UnusedExplicitImport-2.purs
│ ├── Kind-UnusedImport.purs
│ ├── KindReExport.purs
│ ├── MissingTypeDeclaration.purs
│ ├── NewtypeInstance.purs
│ ├── NewtypeInstance2.purs
│ ├── NewtypeInstance3.purs
│ ├── NewtypeInstance4.purs
│ ├── OverlappingPattern.purs
│ ├── ScopeShadowing.purs
│ ├── ScopeShadowing2.purs
│ ├── ShadowedBinderPatternGuard.purs
│ ├── ShadowedNameParens.purs
│ ├── ShadowedTypeVar.purs
│ ├── UnnecessaryFFIModule.js
│ ├── UnnecessaryFFIModule.purs
│ ├── UnusedDctorExplicitImport.purs
│ ├── UnusedDctorImportAll.purs
│ ├── UnusedDctorImportExplicit.purs
│ ├── UnusedExplicitImport.purs
│ ├── UnusedExplicitImportTypeOp.purs
│ ├── UnusedExplicitImportTypeOp
│ └── Lib.purs
│ ├── UnusedExplicitImportValOp.purs
│ ├── UnusedFFIImplementations.js
│ ├── UnusedFFIImplementations.purs
│ ├── UnusedImport.purs
│ ├── UnusedTypeVar.purs
│ ├── WildcardInferredType.purs
│ └── WildcardInferredType2.purs
└── support
├── .gitignore
├── package.json
├── prelude-resolutions.json
├── psc-package.json
├── psci
├── InteractivePrint.purs
├── Reload.edit
└── Reload.purs
├── pscide
├── .gitignore
└── src
│ ├── CompletionSpecDocs.purs
│ ├── FindUsage.purs
│ ├── FindUsage
│ ├── Definition.purs
│ ├── Recursive.purs
│ ├── RecursiveShadowed.purs
│ └── Reexport.purs
│ ├── ImportsSpec.purs
│ ├── ImportsSpec1.purs
│ ├── MatcherSpec.purs
│ ├── RebuildSpecDep.purs
│ ├── RebuildSpecSingleModule.fail
│ ├── RebuildSpecSingleModule.purs
│ ├── RebuildSpecWithDeps.purs
│ ├── RebuildSpecWithForeign.js
│ ├── RebuildSpecWithForeign.purs
│ ├── RebuildSpecWithHiddenIdent.purs
│ └── RebuildSpecWithMissingForeign.fail
└── setup-win.cmd
/Setup.hs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Distribution.Simple
4 |
5 | main :: IO ()
6 | main = defaultMain
7 |
--------------------------------------------------------------------------------
/app/static/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | PureScript Interactive
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/bundle/.gitignore:
--------------------------------------------------------------------------------
1 | build/
2 | *.tar.gz
3 | *.sha
4 | *.md5
5 |
--------------------------------------------------------------------------------
/ci/convert-os-name.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # This script converts the Travis OS name into the format used for PureScript
3 | # binary bundles.
4 | set -e
5 |
6 | case "$TRAVIS_OS_NAME" in
7 | "linux")
8 | echo linux64;;
9 | "osx")
10 | echo macos;;
11 | "windows")
12 | echo win64;;
13 | *)
14 | echo "Unknown TRAVIS_OS_NAME: $TRAVIS_OS_NAME";
15 | exit 1;;
16 | esac
17 |
--------------------------------------------------------------------------------
/core-tests/.gitignore:
--------------------------------------------------------------------------------
1 | core-docs.md
2 | bower_components/
3 | output/
4 |
--------------------------------------------------------------------------------
/core-tests/tests/Main.purs:
--------------------------------------------------------------------------------
1 | module Test.Main where
2 |
3 | import Prelude
4 | import Effect (Effect)
5 | import Test.GenericDeriving as GenericDeriving
6 |
7 | main :: Effect Unit
8 | main = GenericDeriving.main
9 |
--------------------------------------------------------------------------------
/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/purerl/purescript/084dc205c74f570be49734af188ac7330948a823/logo.png
--------------------------------------------------------------------------------
/make_release_notes:
--------------------------------------------------------------------------------
1 | curl https://api.github.com/repos/purescript/purescript/pulls?state=closed\&per_page=100 \
2 | | jq -r '.[] | ("- " + .title + " (@" + .user.login + ")")'
3 |
--------------------------------------------------------------------------------
/npm-package/.gitignore:
--------------------------------------------------------------------------------
1 | purs.bin
2 | package-lock.json
3 |
--------------------------------------------------------------------------------
/npm-package/index.js:
--------------------------------------------------------------------------------
1 | module.exports = require.resolve('./purs.bin');
2 |
--------------------------------------------------------------------------------
/npm-package/purs.bin.placeholder:
--------------------------------------------------------------------------------
1 | # This is a placeholder file of a PureScript binary installed with npm. If you
2 | # see this file, that means the installation has failed and the placeholder has
3 | # not been replaced with a valid binary. Try installing the `purescript` npm
4 | # package again.
5 |
6 | echo >&2 "purescript npm installer: installation failed; please try installing again"
7 | exit 1
8 |
--------------------------------------------------------------------------------
/src/Language/PureScript/CST/Traversals.hs:
--------------------------------------------------------------------------------
1 | module Language.PureScript.CST.Traversals where
2 |
3 | import Prelude
4 |
5 | import Language.PureScript.CST.Types
6 |
7 | everythingOnSeparated :: (r -> r -> r) -> (a -> r) -> Separated a -> r
8 | everythingOnSeparated op k (Separated hd tl) = go hd tl
9 | where
10 | go a [] = k a
11 | go a (b : bs) = k a `op` go (snd b) bs
12 |
--------------------------------------------------------------------------------
/src/Language/PureScript/CodeGen.hs:
--------------------------------------------------------------------------------
1 | -- |
2 | -- A collection of modules related to code generation:
3 | --
4 | -- [@Language.PureScript.CodeGen.JS@] Code generator for JavaScript
5 | --
6 | module Language.PureScript.CodeGen (module C) where
7 |
8 | import Language.PureScript.CodeGen.JS as C
9 |
--------------------------------------------------------------------------------
/src/Language/PureScript/Docs/Utils/MonoidExtras.hs:
--------------------------------------------------------------------------------
1 | module Language.PureScript.Docs.Utils.MonoidExtras where
2 |
3 | import Data.Monoid
4 |
5 | mintersperse :: (Monoid m) => m -> [m] -> m
6 | mintersperse _ [] = mempty
7 | mintersperse _ [x] = x
8 | mintersperse sep (x:xs) = x <> sep <> mintersperse sep xs
9 |
--------------------------------------------------------------------------------
/tests/PscIdeSpec.hs:
--------------------------------------------------------------------------------
1 | {-# OPTIONS_GHC -F -pgmF hspec-discover -optF --module-name=PscIdeSpec #-}
2 |
--------------------------------------------------------------------------------
/tests/TestPsci.hs:
--------------------------------------------------------------------------------
1 | module TestPsci where
2 |
3 | import Prelude ()
4 | import Prelude.Compat
5 |
6 | import TestPsci.CommandTest (commandTests)
7 | import TestPsci.CompletionTest (completionTests)
8 | import TestPsci.EvalTest (evalTests)
9 |
10 | import Test.Tasty
11 | import Test.Tasty.Hspec
12 |
13 | main :: IO TestTree
14 | main = testSpec "repl" $ do
15 | completionTests
16 | commandTests
17 | evalTests
18 |
--------------------------------------------------------------------------------
/tests/purs/.gitignore:
--------------------------------------------------------------------------------
1 | shelltest/tests
2 |
--------------------------------------------------------------------------------
/tests/purs/bundle/3727.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | exports.foo = 1;
4 | exports.bar = exports.foo;
5 |
--------------------------------------------------------------------------------
/tests/purs/bundle/3727.purs:
--------------------------------------------------------------------------------
1 | module Main (main) where
2 |
3 | import Prelude
4 | import Effect (Effect)
5 | import Effect.Console (log)
6 | import Test.Assert (assert)
7 |
8 | main :: Effect Unit
9 | main = do
10 | assert (bar == 1)
11 | log "Done"
12 |
13 | foreign import bar :: Int
14 |
--------------------------------------------------------------------------------
/tests/purs/bundle/ObjectShorthand.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | var foo = 1;
4 |
5 | exports.bar = { foo };
6 |
7 | var baz = 2;
8 |
9 | exports.quux = function(baz) {
10 | return { baz };
11 | };
12 |
13 | var fs = require('fs');
14 | var source = fs.readFileSync(__filename, 'utf-8');
15 | exports.bazIsEliminated = !/^ *var baz =/m.test(source);
16 |
--------------------------------------------------------------------------------
/tests/purs/bundle/PSasConstructor.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect (Effect)
5 | import Effect.Console (log)
6 |
7 | data P = PS
8 |
9 | main :: Effect Unit
10 | main = do
11 | log "Done"
12 |
--------------------------------------------------------------------------------
/tests/purs/docs/bower_components/purescript-newtype/src/Data/Newtype.purs:
--------------------------------------------------------------------------------
1 | module Data.Newtype where
2 |
3 | class Newtype t a | t -> a where
4 | wrap :: a -> t
5 | unwrap :: t -> a
6 |
--------------------------------------------------------------------------------
/tests/purs/docs/bower_components/purescript-prelude/src/Prelude.purs:
--------------------------------------------------------------------------------
1 | module Prelude where
2 |
3 | newtype Unit = Unit {}
4 |
5 | unit :: Unit
6 | unit = Unit {}
7 |
8 | data Boolean2 = True | False
9 |
--------------------------------------------------------------------------------
/tests/purs/docs/resolutions.json:
--------------------------------------------------------------------------------
1 | {
2 | "purescript-prelude": {
3 | "version": "1.0.0",
4 | "path": "bower_components/purescript-prelude"
5 | },
6 | "purescript-newtype": {
7 | "version": "1.0.0",
8 | "path": "bower_components/purescript-newtype"
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/tests/purs/docs/src/Ado.purs:
--------------------------------------------------------------------------------
1 | -- See https://github.com/purescript/purescript/issues/3414
2 | module Ado where
3 |
4 | test =
5 | ado x <- 1
6 | in x
7 |
8 | where
9 | map f x = f x
10 |
--------------------------------------------------------------------------------
/tests/purs/docs/src/Clash.purs:
--------------------------------------------------------------------------------
1 | module Clash (module Clash1) where
2 |
3 | import Clash1 as Clash1
4 | import Clash2 as Clash2
5 |
--------------------------------------------------------------------------------
/tests/purs/docs/src/Clash1.purs:
--------------------------------------------------------------------------------
1 | module Clash1 (module Clash1a) where
2 |
3 | import Clash1a
4 |
--------------------------------------------------------------------------------
/tests/purs/docs/src/Clash1a.purs:
--------------------------------------------------------------------------------
1 | module Clash1a where
2 |
3 | value :: Int
4 | value = 0
5 |
6 | type Type = Int
7 |
8 | class TypeClass a where
9 | typeClassMember :: a
10 |
--------------------------------------------------------------------------------
/tests/purs/docs/src/Clash2.purs:
--------------------------------------------------------------------------------
1 | module Clash2 (module Clash2a) where
2 |
3 | import Clash2a
4 |
--------------------------------------------------------------------------------
/tests/purs/docs/src/Clash2a.purs:
--------------------------------------------------------------------------------
1 | module Clash2a where
2 |
3 | value :: String
4 | value = "hello"
5 |
6 | type Type = String
7 |
8 | class TypeClass a b where
9 | typeClassMember :: a -> b
10 |
--------------------------------------------------------------------------------
/tests/purs/docs/src/ConstrainedArgument.purs:
--------------------------------------------------------------------------------
1 | module ConstrainedArgument where
2 |
3 | class Foo t
4 |
5 | type WithoutArgs = forall a. (Partial => a) -> a
6 | type WithArgs = forall a. (Foo a => a) -> a
7 | type MultiWithoutArgs = forall a. (Partial => Partial => a) -> a
8 | type MultiWithArgs = forall a b. (Foo a => Foo b => a) -> a
9 |
--------------------------------------------------------------------------------
/tests/purs/docs/src/DeclOrder.purs:
--------------------------------------------------------------------------------
1 | module DeclOrder
2 | ( class A
3 | , x1
4 | , X2
5 | , x3
6 | , X4
7 | , class B
8 | ) where
9 |
10 | x1 = 0
11 | x3 = 0
12 |
13 | data X2
14 | data X4
15 |
16 | class A
17 | class B
18 |
--------------------------------------------------------------------------------
/tests/purs/docs/src/DeclOrderNoExportList.purs:
--------------------------------------------------------------------------------
1 | module DeclOrderNoExportList where
2 |
3 | x1 = 0
4 | x3 = 0
5 |
6 | data X2
7 | data X4
8 |
9 | class A
10 | class B
11 |
--------------------------------------------------------------------------------
/tests/purs/docs/src/Desugar.purs:
--------------------------------------------------------------------------------
1 | module Desugar where
2 |
3 | data X a b = X a b
4 |
5 | test :: forall a b. X (a -> b) a -> b
6 | test x =
7 | let X a b = x
8 | in a b
9 |
--------------------------------------------------------------------------------
/tests/purs/docs/src/DocComments.purs:
--------------------------------------------------------------------------------
1 | module DocComments where
2 |
3 | -- | This declaration has a code block:
4 | -- |
5 | -- | example == 0
6 | -- |
7 | -- | Here we are really testing that the leading whitespace is not stripped, as
8 | -- | this ensures that we don't accidentally change code blocks into normal
9 | -- | paragraphs.
10 | example :: Int
11 | example = 0
12 |
--------------------------------------------------------------------------------
/tests/purs/docs/src/DocCommentsClassMethod.purs:
--------------------------------------------------------------------------------
1 | module DocCommentsClassMethod where
2 |
3 | class Foo a where
4 | -- | class method comment
5 | bar :: a
6 | baz :: String -> a
7 |
--------------------------------------------------------------------------------
/tests/purs/docs/src/DocCommentsDataConstructor.purs:
--------------------------------------------------------------------------------
1 | module DocCommentsDataConstructor where
2 |
3 | data Foo
4 | -- | data constructor comment
5 | = Bar
6 | | Baz
7 |
8 | data ComplexFoo a b
9 | = ComplexBar a
10 | -- | another data constructor comment
11 | | ComplexBaz a b
12 |
13 | newtype NewtypeFoo
14 | -- | newtype data constructor comment
15 | = NewtypeFoo { newtypeBar :: String }
16 |
--------------------------------------------------------------------------------
/tests/purs/docs/src/DuplicateNames.purs:
--------------------------------------------------------------------------------
1 | module DuplicateNames
2 | ( module DuplicateNames
3 | , module Prelude
4 | ) where
5 |
6 | import Prelude (Unit)
7 |
8 | unit :: Int
9 | unit = 0
10 |
--------------------------------------------------------------------------------
/tests/purs/docs/src/Example.purs:
--------------------------------------------------------------------------------
1 | module Example
2 | ( module Prelude
3 | , module Example2
4 | ) where
5 |
6 | import Prelude (Unit())
7 | import Example2 (one)
8 |
--------------------------------------------------------------------------------
/tests/purs/docs/src/Example2.purs:
--------------------------------------------------------------------------------
1 | module Example2 where
2 |
3 | one :: Int
4 | one = 1
5 |
6 | two :: Int
7 | two = 2
8 |
--------------------------------------------------------------------------------
/tests/purs/docs/src/ExplicitExport.purs:
--------------------------------------------------------------------------------
1 | module ExplicitExport (one) where
2 |
3 | one :: Int
4 | one = 1
5 |
6 | two :: Int
7 | two = 2
8 |
--------------------------------------------------------------------------------
/tests/purs/docs/src/ImportedTwiceA.purs:
--------------------------------------------------------------------------------
1 | module ImportedTwiceA
2 | ( module ImportedTwiceB )
3 | where
4 |
5 | import ImportedTwiceB
6 |
7 | bar :: Int
8 | bar = 1
9 |
--------------------------------------------------------------------------------
/tests/purs/docs/src/ImportedTwiceB.purs:
--------------------------------------------------------------------------------
1 | module ImportedTwiceB where
2 |
3 | foo :: Int
4 | foo = 0
5 |
--------------------------------------------------------------------------------
/tests/purs/docs/src/MultiVirtual.purs:
--------------------------------------------------------------------------------
1 | module MultiVirtual
2 | ( module X )
3 | where
4 |
5 | import MultiVirtual1 as X
6 | import MultiVirtual2 as X
7 |
--------------------------------------------------------------------------------
/tests/purs/docs/src/MultiVirtual1.purs:
--------------------------------------------------------------------------------
1 | module MultiVirtual1 where
2 |
3 | foo :: Int
4 | foo = 1
5 |
--------------------------------------------------------------------------------
/tests/purs/docs/src/MultiVirtual2.purs:
--------------------------------------------------------------------------------
1 | module MultiVirtual2
2 | ( module MultiVirtual2
3 | , module MultiVirtual3
4 | ) where
5 |
6 | import MultiVirtual3
7 |
8 | bar :: Int
9 | bar = 2
10 |
--------------------------------------------------------------------------------
/tests/purs/docs/src/MultiVirtual3.purs:
--------------------------------------------------------------------------------
1 | module MultiVirtual3 where
2 |
3 | baz :: Int
4 | baz = 3
5 |
--------------------------------------------------------------------------------
/tests/purs/docs/src/NewOperators.purs:
--------------------------------------------------------------------------------
1 | module NewOperators
2 | ( module NewOperators2 )
3 | where
4 |
5 | import NewOperators2
6 |
--------------------------------------------------------------------------------
/tests/purs/docs/src/NewOperators2.purs:
--------------------------------------------------------------------------------
1 | module NewOperators2 where
2 |
3 | infixl 8 _compose as >>>
4 |
5 | _compose :: forall a b c. (b -> c) -> (a -> b) -> (a -> c)
6 | _compose f g x = f (g x)
7 |
--------------------------------------------------------------------------------
/tests/purs/docs/src/NotAllCtors.purs:
--------------------------------------------------------------------------------
1 | module NotAllCtors
2 | ( module Prelude )
3 | where
4 |
5 | import Prelude (Boolean2(True))
6 |
--------------------------------------------------------------------------------
/tests/purs/docs/src/PrimSubmodules.purs:
--------------------------------------------------------------------------------
1 | module PrimSubmodules (Lol(..), x, y, module O) where
2 |
3 | import Prim.Ordering (kind Ordering, LT, EQ, GT) as O
4 |
5 | data Lol (a :: O.Ordering) = Lol Int
6 |
7 | x :: Lol O.LT
8 | x = Lol 0
9 |
10 | y :: Lol O.EQ
11 | y = Lol 1
12 |
--------------------------------------------------------------------------------
/tests/purs/docs/src/ReExportedTypeClass.purs:
--------------------------------------------------------------------------------
1 | module ReExportedTypeClass
2 | ( module SomeTypeClass )
3 | where
4 |
5 | import SomeTypeClass
6 |
--------------------------------------------------------------------------------
/tests/purs/docs/src/SolitaryTypeClassMember.purs:
--------------------------------------------------------------------------------
1 | module SolitaryTypeClassMember
2 | ( module SomeTypeClass )
3 | where
4 |
5 | import SomeTypeClass (member)
6 |
7 |
--------------------------------------------------------------------------------
/tests/purs/docs/src/SomeTypeClass.purs:
--------------------------------------------------------------------------------
1 |
2 | module SomeTypeClass where
3 |
4 | class SomeClass a where
5 | member :: a
6 |
--------------------------------------------------------------------------------
/tests/purs/docs/src/Transitive1.purs:
--------------------------------------------------------------------------------
1 | module Transitive1
2 | ( module Transitive2 )
3 | where
4 |
5 | import Transitive2
6 |
--------------------------------------------------------------------------------
/tests/purs/docs/src/Transitive2.purs:
--------------------------------------------------------------------------------
1 | module Transitive2
2 | ( module Transitive3 )
3 | where
4 |
5 | import Transitive3
6 |
--------------------------------------------------------------------------------
/tests/purs/docs/src/Transitive3.purs:
--------------------------------------------------------------------------------
1 | module Transitive3 where
2 |
3 | transitive3 :: Int
4 | transitive3 = 0
5 |
--------------------------------------------------------------------------------
/tests/purs/docs/src/TypeClassWithFunDeps.purs:
--------------------------------------------------------------------------------
1 |
2 | module TypeClassWithFunDeps where
3 |
4 | class TypeClassWithFunDeps a b c d e | a b -> c, c -> d e where
5 | aMember :: a -> b
6 |
--------------------------------------------------------------------------------
/tests/purs/docs/src/TypeClassWithoutMembers.purs:
--------------------------------------------------------------------------------
1 | module TypeClassWithoutMembers
2 | ( module TypeClassWithoutMembersIntermediate )
3 | where
4 |
5 | import TypeClassWithoutMembersIntermediate
6 |
--------------------------------------------------------------------------------
/tests/purs/docs/src/TypeClassWithoutMembersIntermediate.purs:
--------------------------------------------------------------------------------
1 | module TypeClassWithoutMembersIntermediate
2 | ( module SomeTypeClass )
3 | where
4 |
5 | import SomeTypeClass (class SomeClass)
6 |
--------------------------------------------------------------------------------
/tests/purs/docs/src/TypeLevelString.purs:
--------------------------------------------------------------------------------
1 | module TypeLevelString where
2 |
3 | import Prim.TypeError (class Fail, Text)
4 |
5 | data Foo
6 |
7 | class Bar a
8 |
9 | instance fooBar :: Fail (Text "oops") => Bar Foo
10 |
--------------------------------------------------------------------------------
/tests/purs/docs/src/TypeSynonym.purs:
--------------------------------------------------------------------------------
1 | module TypeSynonym where
2 |
3 | type MyInt = Int
4 |
--------------------------------------------------------------------------------
/tests/purs/docs/src/TypeSynonymInstance.purs:
--------------------------------------------------------------------------------
1 | -- see #3624
2 | module TypeSynonymInstance where
3 |
4 | import Data.Newtype (class Newtype)
5 | import TypeSynonym (MyInt)
6 |
7 | newtype MyNT = MyNT MyInt
8 |
9 | derive instance ntMyNT :: Newtype MyNT _
10 |
11 | foo = 0
12 |
--------------------------------------------------------------------------------
/tests/purs/docs/src/UTF8.purs:
--------------------------------------------------------------------------------
1 | module UTF8 where
2 |
3 | import Prelude (Unit, unit)
4 |
5 | -- | üÜäÄ 😰
6 | thing :: Unit
7 | thing = unit
8 |
--------------------------------------------------------------------------------
/tests/purs/docs/src/Virtual.purs:
--------------------------------------------------------------------------------
1 | module Virtual
2 | ( module VirtualPrelude )
3 | where
4 |
5 | import Prelude as VirtualPrelude
6 |
--------------------------------------------------------------------------------
/tests/purs/failing/1071.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith KindsDoNotUnify
2 | module Main where
3 |
4 | class Foo a b where
5 | foo :: a -> b
6 |
7 | bar :: forall a. Foo a => a -> a
8 | bar a = a
9 |
--------------------------------------------------------------------------------
/tests/purs/failing/1169.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith IncorrectConstructorArity
2 | module Test where
3 |
4 | data Outer a = Outer a
5 |
6 | data Inner a b = Inner a b
7 |
8 | test1 :: forall a b. Outer (Inner a b) -> Boolean
9 | test1 (Outer (Inner _)) = true
10 |
11 | test2 :: forall a b. Inner a b -> Boolean
12 | test2 (Inner _) = true
13 |
--------------------------------------------------------------------------------
/tests/purs/failing/1175.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith TypesDoNotUnify
2 | module X where
3 |
4 | class Foo where
5 | foo :: String
6 |
7 | instance f :: Foo where
8 | foo = "a"
9 | where
10 | bar :: String
11 | bar = 1
12 |
--------------------------------------------------------------------------------
/tests/purs/failing/1310.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith NoInstanceFound
2 |
3 | module Issue1310 where
4 |
5 | import Prelude
6 | import Effect
7 | import Effect.Console
8 |
9 | class Inject f g where
10 | inj :: forall a. f a -> g a
11 |
12 | instance inject :: Inject f f where
13 | inj x = x
14 |
15 | newtype Oops a = Oops (Effect a)
16 |
17 | main :: Effect Unit
18 | main = inj (Oops (log "Oops"))
19 |
--------------------------------------------------------------------------------
/tests/purs/failing/1570.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith ExpectedType
2 | module M where
3 |
4 | data F a = F a
5 |
6 | test = \(x :: F) -> x
7 |
--------------------------------------------------------------------------------
/tests/purs/failing/1733.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith UnknownName
2 | module Main where
3 |
4 | import Thingy as Thing
5 |
6 | main = Thing.doesntExist "hi"
7 |
--------------------------------------------------------------------------------
/tests/purs/failing/1733/Thingy.purs:
--------------------------------------------------------------------------------
1 | module Thingy where
2 |
3 | foo :: Int
4 | foo = 1
5 |
--------------------------------------------------------------------------------
/tests/purs/failing/1825.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith UnknownName
2 |
3 | module Main where
4 |
5 | data W = X | Y | Z
6 |
7 | bad X a = a
8 | bad Y _ = a
9 | bad Z a = a
10 |
--------------------------------------------------------------------------------
/tests/purs/failing/1881.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith ErrorParsingModule
2 | module Main where
3 |
4 | foo =
5 | bar :: Int
6 | bar = 3
7 |
--------------------------------------------------------------------------------
/tests/purs/failing/2128-class.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith ErrorParsingModule
2 | module Main where
3 |
4 | class Foo a where
5 | foo :: a -> !!!
6 |
--------------------------------------------------------------------------------
/tests/purs/failing/2128-instance.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith ErrorParsingModule
2 | module Main where
3 |
4 | class Foo a where
5 | foo :: a
6 |
7 | instance fooInt :: Foo Int where
8 | foo = !!!
9 |
--------------------------------------------------------------------------------
/tests/purs/failing/2197-shouldFail.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith ScopeConflict
2 | module Main where
3 |
4 | import Prim as P
5 | import Prim (Number)
6 |
7 | type Number = P.Number
8 |
9 | z :: Number
10 | z = 0.0
11 |
--------------------------------------------------------------------------------
/tests/purs/failing/2197-shouldFail2.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith UnknownName
2 | module Main where
3 |
4 | import Prim (Boolean)
5 |
6 | z :: Number
7 | z = 0.0
8 |
--------------------------------------------------------------------------------
/tests/purs/failing/2378.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith OrphanInstance
2 | module Main where
3 |
4 | import Lib
5 |
6 | instance fooX :: Foo "x"
7 |
--------------------------------------------------------------------------------
/tests/purs/failing/2378/Lib.purs:
--------------------------------------------------------------------------------
1 | module Lib (class Foo) where
2 |
3 | class Foo (a :: Symbol)
4 |
--------------------------------------------------------------------------------
/tests/purs/failing/2379.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith UnknownClass
2 | module Main where
3 |
4 | import Lib
5 |
6 | test = x [1, 2, 3]
7 |
--------------------------------------------------------------------------------
/tests/purs/failing/2379/Lib.purs:
--------------------------------------------------------------------------------
1 | module Lib (class X, x) where
2 |
3 | class X a where
4 | x :: a -> String
5 |
6 | class Y a
7 |
8 | instance xArray :: Y a => X (Array a) where
9 | x _ = "[]"
10 |
--------------------------------------------------------------------------------
/tests/purs/failing/2434.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith ErrorParsingModule
2 | module Main where
3 |
4 | x :: Char
5 | x = '\x10000'
6 |
--------------------------------------------------------------------------------
/tests/purs/failing/2534.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith InfiniteType
2 | module Main where
3 |
4 | foo :: Array Int -> Int
5 | foo xs = go xs where
6 | go :: Array _ -> Int
7 | go [] = 0
8 | go xs = go [xs]
9 |
--------------------------------------------------------------------------------
/tests/purs/failing/2542.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith UndefinedTypeVariable
2 | module Main where
3 |
4 | type T = forall a. Array a
5 |
6 | foo :: T
7 | foo = bar where
8 | bar :: Array a
9 | bar = []
10 |
--------------------------------------------------------------------------------
/tests/purs/failing/2567.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith NoInstanceFound
2 | module Main where
3 |
4 | import Prim.TypeError
5 |
6 | foo :: Int
7 | foo = (0 :: Fail (Text "This constraint should be checked") => Int)
8 |
--------------------------------------------------------------------------------
/tests/purs/failing/2601.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith KindsDoNotUnify
2 | module Main where
3 |
4 | type Syn (a :: Type -> Type) = String
5 |
6 | val :: Syn Int
7 | val = "bad"
8 |
--------------------------------------------------------------------------------
/tests/purs/failing/2616.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith NoInstanceFound
2 | module Main where
3 |
4 | import Prelude
5 |
6 | newtype Foo r = Foo { | r }
7 |
8 | derive instance eqFoo :: Eq (Foo r)
9 | derive instance ordFoo :: Ord (Foo r)
10 |
--------------------------------------------------------------------------------
/tests/purs/failing/2806.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith NoInstanceFound
2 | module X where
3 |
4 | data E a b = L a | R b
5 |
6 | g :: forall a b . E a b -> a
7 | g e | L x <- e = x
8 |
--------------------------------------------------------------------------------
/tests/purs/failing/2874-forall.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith ErrorParsingModule
2 | module Main where
3 |
4 | class T a b | a -> b
5 | instance tT :: (T Int (forall a. a)) => T Int String
6 |
7 | ddd :: Int
8 | ddd = 0 :: forall t. T Int t => Int
9 |
--------------------------------------------------------------------------------
/tests/purs/failing/2874-forall2.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith ErrorParsingModule
2 | module Main where
3 |
4 | class X a b | a -> b
5 | class X a (forall t. t) <= Y a b | a -> b
6 | instance tX :: X Int String
7 | instance tY :: Y Int Boolean
8 |
9 | ggg :: Int
10 | ggg = 0 :: forall t. Y Int t => Int
11 |
--------------------------------------------------------------------------------
/tests/purs/failing/2874-wildcard.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith ErrorParsingModule
2 | module Main where
3 |
4 | class Foo a where
5 | foo :: a
6 |
7 | class Baz b where
8 | baz :: b
9 |
10 | instance bazFoo :: (Baz _) => Foo b where
11 | foo = baz
12 |
--------------------------------------------------------------------------------
/tests/purs/failing/2947.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith ErrorParsingModule
2 |
3 | module Main where
4 |
5 | import Prelude
6 |
7 | data Foo = Foo
8 |
9 | instance eqFoo :: Eq Foo where
10 | eq _ _ = true
11 |
--------------------------------------------------------------------------------
/tests/purs/failing/3132.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith TransitiveExportError
2 | module Main (class C3) where
3 |
4 | import Prelude
5 |
6 | import Effect (Effect)
7 | import Effect.Console (log)
8 |
9 | class C1
10 | instance inst1 :: C1
11 |
12 | class C1 <= C2 a
13 |
14 | class (C2 a) <= C3 a b
15 |
16 | main :: Effect Unit
17 | main = do
18 | log "Done"
19 |
--------------------------------------------------------------------------------
/tests/purs/failing/3275-BindingGroupErrorPos.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith KindsDoNotUnify
2 | module BindingGroupErrorPos where
3 |
4 | -- This isn't really about KindsDoNotUnify, it's about positioning errors
5 | -- that occur in binding groups
6 |
7 | import Prelude
8 |
9 | type Result = Array Int
10 |
11 | wrong :: Int -> Result String
12 | wrong n = wrong (n - 1)
13 |
--------------------------------------------------------------------------------
/tests/purs/failing/3275-DataBindingGroupErrorPos.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith KindsDoNotUnify
2 | module DataBindingGroupErrorPos where
3 |
4 | -- This isn't really about KindsDoNotUnify, it's about positioning errors
5 | -- that occur in data binding groups
6 |
7 | data Foo a = Foo (Bar a a)
8 | data Bar a = Bar (Foo a)
9 |
--------------------------------------------------------------------------------
/tests/purs/failing/3335-TypeOpAssociativityError.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith NonAssociativeError
2 | module Main where
3 |
4 | infix 6 type Function as >>
5 |
6 | const :: forall a b. a >> b >> a
7 | const a _ = a
8 |
--------------------------------------------------------------------------------
/tests/purs/failing/3405.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith CannotFindDerivingType
2 | module Main where
3 |
4 | import Prelude
5 |
6 | type Something = Int
7 |
8 | derive instance eqSomething ∷ Eq Something
9 |
--------------------------------------------------------------------------------
/tests/purs/failing/3549-a.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith UnknownName
2 | module Main where
3 |
4 | import Effect.Console (log)
5 |
6 | identity :: forall (a :: Typ) . a -> a
7 | identity x = x
8 |
9 | main = log "Done"
10 |
11 |
--------------------------------------------------------------------------------
/tests/purs/failing/3549.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith KindsDoNotUnify
2 | module Main where
3 |
4 | import Prelude
5 |
6 | import Effect.Console (log)
7 |
8 | map' :: forall (f :: Type -> Type -> Type) (a :: Type) (b :: Type) . Functor f => (a -> b) -> f a -> f b
9 | map' = map
10 |
11 | main = log "Done"
12 |
--------------------------------------------------------------------------------
/tests/purs/failing/365.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith CycleInDeclaration
2 | module Main where
3 |
4 | import Prelude
5 |
6 | class C a where
7 | f :: a -> a
8 | g :: a -> a
9 |
10 | instance cS :: C String where
11 | f s = s
12 | g = f
13 |
14 | main = g "Done"
15 |
--------------------------------------------------------------------------------
/tests/purs/failing/3689.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith ErrorParsingModule
2 | module Main where
3 |
4 | test =
5 | { "bad"
6 | }
7 |
--------------------------------------------------------------------------------
/tests/purs/failing/438.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith PossiblyInfiniteInstance
2 |
3 | -- See issue 438 for details: this test is mainly here to test that code like
4 | -- this doesn't cause the compiler to loop.
5 |
6 | module Main where
7 |
8 | import Prelude
9 |
10 | data Fix f = In (f (Fix f))
11 |
12 | instance eqFix :: (Eq (f (Fix f))) => Eq (Fix f) where
13 | eq (In f) (In g) = f == g
14 |
15 | example = In [] == In []
16 |
--------------------------------------------------------------------------------
/tests/purs/failing/881.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith DuplicateValueDeclaration
2 | module Main where
3 |
4 | data X = X | Y
5 |
6 | class Foo a where
7 | foo :: a -> a
8 | bar :: a
9 |
10 | instance fooX :: Foo X where
11 | foo X = X
12 | bar = X
13 | foo Y = Y
14 |
--------------------------------------------------------------------------------
/tests/purs/failing/AnonArgument1.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith IncorrectAnonymousArgument
2 | module Main where
3 |
4 | test :: Int -> Int
5 | test = _
6 |
--------------------------------------------------------------------------------
/tests/purs/failing/AnonArgument2.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith IncorrectAnonymousArgument
2 | module Main where
3 |
4 | import Prelude
5 |
6 | test :: Int -> Int
7 | test = 1 + 2 * _
8 |
--------------------------------------------------------------------------------
/tests/purs/failing/AnonArgument3.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith IncorrectAnonymousArgument
2 | module Main where
3 |
4 | test :: Int -> Int
5 | test = 1 + _
6 |
--------------------------------------------------------------------------------
/tests/purs/failing/ApostropheModuleName.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith ErrorParsingModule
2 | -- see #3601
3 | module Bad'Module where
4 |
5 | import Effect.Console (log)
6 |
7 | main = log "Done"
8 |
--------------------------------------------------------------------------------
/tests/purs/failing/ArgLengthMismatch.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith ArgListLengthsDiffer
2 | module ArgLengthMismatch where
3 |
4 | import Prelude
5 |
6 | f x y = true
7 | f = false
8 |
--------------------------------------------------------------------------------
/tests/purs/failing/ArrayType.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith TypesDoNotUnify
2 |
3 | module Main where
4 |
5 | import Prelude
6 |
7 | bar :: Number -> Number -> Number
8 | bar n m = n + m
9 |
10 | foo = x `bar` y
11 | where
12 | x = 1
13 | y = []
14 |
--------------------------------------------------------------------------------
/tests/purs/failing/Arrays.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith TypesDoNotUnify
2 | module Main where
3 |
4 | foreign import ix :: forall a. Array a -> Int -> a
5 |
6 | test = \arr -> arr `ix` (0 `ix` 0)
7 |
--------------------------------------------------------------------------------
/tests/purs/failing/AtPatternPrecedence.purs:
--------------------------------------------------------------------------------
1 | -- See #3532
2 | -- @shouldFailWith ArgListLengthsDiffer
3 | module Main where
4 |
5 | import Effect.Console (log)
6 |
7 | data X = X String | Y
8 |
9 | oops :: X -> String
10 | -- previously this was parsed as x@(X s)
11 | oops x@X s = s
12 | oops Y = "Y"
13 |
14 | main = log (oops (X "Done"))
15 |
--------------------------------------------------------------------------------
/tests/purs/failing/BindInDo-2.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith CannotUseBindWithDo
2 | module Main where
3 |
4 | import Prelude
5 |
6 | foo = do
7 | let bind = 42
8 | x <- [4, 5, 6]
9 | pure x
10 |
--------------------------------------------------------------------------------
/tests/purs/failing/BindInDo.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith CannotUseBindWithDo
2 | module Main where
3 |
4 | import Prelude
5 |
6 | foo = do
7 | bind <- [1,2,3]
8 | x <- [4, 5, 6]
9 | pure x
10 |
--------------------------------------------------------------------------------
/tests/purs/failing/CannotDeriveNewtypeForData.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith CannotDeriveNewtypeForData
2 | module CannotDeriveNewtypeForData where
3 |
4 | import Data.Newtype
5 |
6 | data Test = Test String
7 |
8 | derive instance newtypeTest :: Newtype Test _
9 |
--------------------------------------------------------------------------------
/tests/purs/failing/CaseBinderLengthsDiffer.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith CaseBinderLengthDiffers
2 | module Main where
3 |
4 | test = case 1, 2 of
5 | 1, 2, 3 -> 42
6 | _, _ -> 43
7 |
--------------------------------------------------------------------------------
/tests/purs/failing/CaseDoesNotMatchAllConstructorArgs.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith IncorrectConstructorArity
2 | module Main where
3 |
4 | import Prelude
5 |
6 | data Person = Person String Int
7 |
8 | data TwoPeople = Two Person Person
9 |
10 | getName p = case p of
11 | (Two (Person n) (Person n2 a2)) -> n
12 | _ -> "Unknown"
13 |
14 |
15 | name = getName (Two (Person "Jimmy" 20) (Person "" 1))
16 |
--------------------------------------------------------------------------------
/tests/purs/failing/ConflictingExports.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith ScopeConflict
2 | -- Fails here because re-exporting forces any scope conflicts to be resolved
3 | module Main (module A, module B) where
4 |
5 | import A
6 | import B
7 |
--------------------------------------------------------------------------------
/tests/purs/failing/ConflictingExports/A.purs:
--------------------------------------------------------------------------------
1 | module A where
2 |
3 | thing :: Int
4 | thing = 1
5 |
--------------------------------------------------------------------------------
/tests/purs/failing/ConflictingExports/B.purs:
--------------------------------------------------------------------------------
1 | module B where
2 |
3 | thing :: Int
4 | thing = 2
5 |
--------------------------------------------------------------------------------
/tests/purs/failing/ConflictingImports.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith ScopeConflict
2 | module Main where
3 |
4 | import A
5 | import B
6 |
7 | -- Error due to referencing `thing` which is in scope as A.thing and B.thing
8 | what :: Int
9 | what = thing
10 |
--------------------------------------------------------------------------------
/tests/purs/failing/ConflictingImports/A.purs:
--------------------------------------------------------------------------------
1 | module A where
2 |
3 | thing :: Int
4 | thing = 1
5 |
--------------------------------------------------------------------------------
/tests/purs/failing/ConflictingImports/B.purs:
--------------------------------------------------------------------------------
1 | module B where
2 |
3 | thing :: Int
4 | thing = 2
5 |
--------------------------------------------------------------------------------
/tests/purs/failing/ConflictingImports2.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith ScopeConflict
2 | module Main where
3 |
4 | import A (thing)
5 | import B (thing)
6 |
7 | -- Error due to referencing `thing` which is explicitly in scope as A.thing
8 | -- and B.thing
9 | what :: Int
10 | what = thing
11 |
--------------------------------------------------------------------------------
/tests/purs/failing/ConflictingImports2/A.purs:
--------------------------------------------------------------------------------
1 | module A where
2 |
3 | thing :: Int
4 | thing = 1
5 |
--------------------------------------------------------------------------------
/tests/purs/failing/ConflictingImports2/B.purs:
--------------------------------------------------------------------------------
1 | module B where
2 |
3 | thing :: Int
4 | thing = 2
5 |
--------------------------------------------------------------------------------
/tests/purs/failing/ConflictingQualifiedImports.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith ScopeConflict
2 | module Main where
3 |
4 | import A as X
5 | import B as X
6 |
7 | foo = X.thing
8 |
--------------------------------------------------------------------------------
/tests/purs/failing/ConflictingQualifiedImports/A.purs:
--------------------------------------------------------------------------------
1 | module A where
2 |
3 | thing :: Int
4 | thing = 1
5 |
--------------------------------------------------------------------------------
/tests/purs/failing/ConflictingQualifiedImports/B.purs:
--------------------------------------------------------------------------------
1 | module B where
2 |
3 | thing :: Int
4 | thing = 2
5 |
--------------------------------------------------------------------------------
/tests/purs/failing/ConflictingQualifiedImports2.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith ScopeConflict
2 | module Main (module X) where
3 |
4 | import A as X
5 | import B as X
6 |
--------------------------------------------------------------------------------
/tests/purs/failing/ConflictingQualifiedImports2/A.purs:
--------------------------------------------------------------------------------
1 | module A where
2 |
3 | thing :: Int
4 | thing = 1
5 |
--------------------------------------------------------------------------------
/tests/purs/failing/ConflictingQualifiedImports2/B.purs:
--------------------------------------------------------------------------------
1 | module B where
2 |
3 | thing :: Int
4 | thing = 2
5 |
--------------------------------------------------------------------------------
/tests/purs/failing/ConstraintFailure.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith NoInstanceFound
2 |
3 | module Main where
4 |
5 | import Prelude
6 |
7 | data Foo = Bar
8 |
9 | spin :: forall a. a -> Foo
10 | spin x = Bar
11 |
12 | main = show <<< spin
13 |
14 |
--------------------------------------------------------------------------------
/tests/purs/failing/ConstraintInference.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith AmbiguousTypeVariables
2 |
3 | module Main where
4 |
5 | import Prelude
6 |
7 | spin :: forall a b. a -> b
8 | spin x = spin x
9 |
10 | test = show <<< spin
11 |
--------------------------------------------------------------------------------
/tests/purs/failing/DctorOperatorAliasExport.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith TransitiveDctorExportError
2 | module Data.List (List, (:)) where
3 |
4 | data List a = Cons a (List a) | Nil
5 |
6 | infixr 6 Cons as :
7 |
--------------------------------------------------------------------------------
/tests/purs/failing/DeclConflictClassCtor.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith DeclConflict
2 | module Main where
3 |
4 | data T = Fail
5 |
6 | class Fail
7 |
--------------------------------------------------------------------------------
/tests/purs/failing/DeclConflictClassSynonym.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith DeclConflict
2 | module Main where
3 |
4 | import Prelude
5 |
6 | type Fail = Unit
7 |
8 | class Fail
9 |
--------------------------------------------------------------------------------
/tests/purs/failing/DeclConflictClassType.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith DeclConflict
2 | module Main where
3 |
4 | class Fail
5 |
6 | data Fail
7 |
--------------------------------------------------------------------------------
/tests/purs/failing/DeclConflictCtorClass.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith DeclConflict
2 | module Main where
3 |
4 | class Fail
5 |
6 | data T = Fail
7 |
--------------------------------------------------------------------------------
/tests/purs/failing/DeclConflictCtorCtor.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith DeclConflict
2 | module Main where
3 |
4 | data T1 = Fail
5 |
6 | data T2 = Fail
7 |
--------------------------------------------------------------------------------
/tests/purs/failing/DeclConflictDuplicateCtor.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith DeclConflict
2 | module Main where
3 |
4 | data T = Fail | Fail
5 |
6 |
--------------------------------------------------------------------------------
/tests/purs/failing/DeclConflictSynonymClass.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith DeclConflict
2 | module Main where
3 |
4 | import Prelude
5 |
6 | class Fail
7 |
8 | type Fail = Unit
9 |
--------------------------------------------------------------------------------
/tests/purs/failing/DeclConflictSynonymType.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith DeclConflict
2 | module Main where
3 |
4 | import Prelude
5 |
6 | data Fail
7 |
8 | type Fail = Unit
9 |
--------------------------------------------------------------------------------
/tests/purs/failing/DeclConflictTypeClass.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith DeclConflict
2 | module Main where
3 |
4 | class Fail
5 |
6 | data Fail
7 |
--------------------------------------------------------------------------------
/tests/purs/failing/DeclConflictTypeSynonym.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith DeclConflict
2 | module Main where
3 |
4 | import Prelude
5 |
6 | type Fail = Unit
7 |
8 | data Fail
9 |
--------------------------------------------------------------------------------
/tests/purs/failing/DeclConflictTypeType.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith DeclConflict
2 | module Main where
3 |
4 | data Fail
5 |
6 | data Fail
7 |
--------------------------------------------------------------------------------
/tests/purs/failing/DiffKindsSameName/LibA.purs:
--------------------------------------------------------------------------------
1 | module DiffKindsSameName.LibA where
2 |
3 | foreign import kind DemoKind
4 |
5 |
--------------------------------------------------------------------------------
/tests/purs/failing/DiffKindsSameName/LibB.purs:
--------------------------------------------------------------------------------
1 | module DiffKindsSameName.LibB where
2 |
3 | foreign import kind DemoKind
4 |
5 | foreign import data DemoData :: DemoKind
6 |
7 |
--------------------------------------------------------------------------------
/tests/purs/failing/Do.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith InvalidDoBind
2 | -- @shouldFailWith InvalidDoLet
3 | module Main where
4 |
5 | import Prelude
6 |
7 | test1 = do let x = 1
8 |
9 | test2 y = do x <- y
10 |
11 | test3 = do pure 1
12 | pure 2
13 |
--------------------------------------------------------------------------------
/tests/purs/failing/DoNotSuggestComposition.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith TypesDoNotUnify
2 | -- TODO: Check that this does not produce a "function composition is (<<<)"
3 | -- suggestion.
4 | module DoNotSuggestComposition where
5 |
6 | import Prelude
7 |
8 | x = { y: 3 }
9 |
10 | foo :: String -> String
11 | foo y = y
12 |
13 | bar = foo x
14 |
--------------------------------------------------------------------------------
/tests/purs/failing/DoNotSuggestComposition2.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith TypesDoNotUnify
2 | -- TODO: Check that this does not produce a "function composition is (<<<)"
3 | -- suggestion.
4 |
5 | module DoNotSuggestComposition2 where
6 |
7 | foo = let x = { y: 3 } in x 2
8 |
--------------------------------------------------------------------------------
/tests/purs/failing/DuplicateDeclarationsInLet.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith OverlappingNamesInLet
2 | module Main where
3 |
4 | import Prelude
5 |
6 | foo = a
7 | where
8 | a :: Number
9 | a = 1
10 |
11 | a :: Number
12 | a = 2
13 |
--------------------------------------------------------------------------------
/tests/purs/failing/DuplicateInstance.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith DuplicateInstance
2 | module Main where
3 | class X
4 | class Y
5 | instance i :: X
6 | instance i :: Y
7 |
--------------------------------------------------------------------------------
/tests/purs/failing/DuplicateModule.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith DuplicateModule
2 | module M1 where
3 |
--------------------------------------------------------------------------------
/tests/purs/failing/DuplicateModule/M1.purs:
--------------------------------------------------------------------------------
1 | module M1 where
2 |
--------------------------------------------------------------------------------
/tests/purs/failing/DuplicateProperties.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith TypesDoNotUnify
2 | module DuplicateProperties where
3 |
4 | import Prelude
5 |
6 | foreign import data Test :: # Type -> Type
7 |
8 | foreign import subtractX :: forall r. Test (x :: Unit | r) -> Test r
9 |
10 | foreign import hasX :: Test (x :: Unit, y :: Unit)
11 |
12 | baz = subtractX (subtractX hasX)
13 |
--------------------------------------------------------------------------------
/tests/purs/failing/DuplicateTypeClass.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith DuplicateTypeClass
2 | module Main where
3 | class C
4 | class C
5 |
--------------------------------------------------------------------------------
/tests/purs/failing/DuplicateTypeVars.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith DuplicateTypeArgument
2 | module Main where
3 |
4 | import Prelude
5 |
6 | type Foo a a = a
7 |
--------------------------------------------------------------------------------
/tests/purs/failing/EmptyCase.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith ErrorParsingModule
2 | module Main where
3 |
4 | error err = case err of \_ -> 1
5 |
--------------------------------------------------------------------------------
/tests/purs/failing/EmptyClass.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith ErrorParsingModule
2 | module Main where
3 |
4 | class Foo x where
5 |
6 | bar :: String
7 | bar = "hello"
8 |
--------------------------------------------------------------------------------
/tests/purs/failing/EmptyDo.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith ErrorParsingModule
2 |
3 | module Main where
4 |
5 | main = do
6 |
7 |
--------------------------------------------------------------------------------
/tests/purs/failing/ExpectedWildcard.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith ExpectedWildcard
2 | module ExpectedWildcard where
3 |
4 | import Data.Newtype
5 |
6 | data Test = Test String
7 |
8 | derive instance newtypeTest :: Newtype Test String
9 |
--------------------------------------------------------------------------------
/tests/purs/failing/ExportConflictClass.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith ExportConflict
2 | module C (module A, module B) where
3 |
4 | import A as A
5 | import B as B
6 |
--------------------------------------------------------------------------------
/tests/purs/failing/ExportConflictClass/A.purs:
--------------------------------------------------------------------------------
1 | module A where
2 |
3 | class X
4 |
--------------------------------------------------------------------------------
/tests/purs/failing/ExportConflictClass/B.purs:
--------------------------------------------------------------------------------
1 | module B where
2 |
3 | class X
4 |
--------------------------------------------------------------------------------
/tests/purs/failing/ExportConflictClassAndType.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith ExportConflict
2 | module C (module A, module B) where
3 |
4 | import A as A
5 | import B as B
6 |
--------------------------------------------------------------------------------
/tests/purs/failing/ExportConflictClassAndType/A.purs:
--------------------------------------------------------------------------------
1 | module A where
2 |
3 | class X
4 |
--------------------------------------------------------------------------------
/tests/purs/failing/ExportConflictClassAndType/B.purs:
--------------------------------------------------------------------------------
1 | module B where
2 |
3 | data X
4 |
--------------------------------------------------------------------------------
/tests/purs/failing/ExportConflictCtor.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith ExportConflict
2 | module C (module A, module B) where
3 |
4 | import A as A
5 | import B as B
6 |
--------------------------------------------------------------------------------
/tests/purs/failing/ExportConflictCtor/A.purs:
--------------------------------------------------------------------------------
1 | module A where
2 |
3 | data T1 = X
4 |
--------------------------------------------------------------------------------
/tests/purs/failing/ExportConflictCtor/B.purs:
--------------------------------------------------------------------------------
1 | module B where
2 |
3 | data T2 = X
4 |
--------------------------------------------------------------------------------
/tests/purs/failing/ExportConflictType.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith ExportConflict
2 | module C (module A, module B) where
3 |
4 | import A as A
5 | import B as B
6 |
--------------------------------------------------------------------------------
/tests/purs/failing/ExportConflictType/A.purs:
--------------------------------------------------------------------------------
1 | module A where
2 |
3 | data T
4 |
--------------------------------------------------------------------------------
/tests/purs/failing/ExportConflictType/B.purs:
--------------------------------------------------------------------------------
1 | module B where
2 |
3 | data T
4 |
--------------------------------------------------------------------------------
/tests/purs/failing/ExportConflictTypeOp.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith ExportConflict
2 | module C (module A, module B) where
3 |
4 | import A as A
5 | import B as B
6 |
--------------------------------------------------------------------------------
/tests/purs/failing/ExportConflictTypeOp/A.purs:
--------------------------------------------------------------------------------
1 | module A where
2 |
3 | type T1 a b = a -> b
4 |
5 | infixr 4 type T1 as ??
6 |
--------------------------------------------------------------------------------
/tests/purs/failing/ExportConflictTypeOp/B.purs:
--------------------------------------------------------------------------------
1 | module B where
2 |
3 | type T2 a b = a -> b
4 |
5 | infixr 4 type T2 as ??
6 |
--------------------------------------------------------------------------------
/tests/purs/failing/ExportConflictValue.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith ExportConflict
2 | module C (module A, module B) where
3 |
4 | import A as A
5 | import B as B
6 |
--------------------------------------------------------------------------------
/tests/purs/failing/ExportConflictValue/A.purs:
--------------------------------------------------------------------------------
1 | module A where
2 |
3 | x :: Boolean
4 | x = true
5 |
--------------------------------------------------------------------------------
/tests/purs/failing/ExportConflictValue/B.purs:
--------------------------------------------------------------------------------
1 | module B where
2 |
3 | x :: Boolean
4 | x = false
5 |
--------------------------------------------------------------------------------
/tests/purs/failing/ExportConflictValueOp.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith ExportConflict
2 | module C (module A, module B) where
3 |
4 | import A as A
5 | import B as B
6 |
--------------------------------------------------------------------------------
/tests/purs/failing/ExportConflictValueOp/A.purs:
--------------------------------------------------------------------------------
1 | module A where
2 |
3 | f1 :: forall a b. a -> b -> a
4 | f1 x _ = x
5 |
6 | infix 0 f1 as !!
7 |
--------------------------------------------------------------------------------
/tests/purs/failing/ExportConflictValueOp/B.purs:
--------------------------------------------------------------------------------
1 | module B where
2 |
3 | f2 :: forall a b. a -> b -> a
4 | f2 x _ = x
5 |
6 | infix 0 f2 as !!
7 |
--------------------------------------------------------------------------------
/tests/purs/failing/ExportExplicit.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith UnknownExport
2 | -- should fail as z does not exist in the module
3 | module M1 (x, y, z) where
4 |
5 | import Prelude
6 |
7 | x = 1
8 | y = 2
9 |
--------------------------------------------------------------------------------
/tests/purs/failing/ExportExplicit1.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith UnknownName
2 | module Main where
3 |
4 | import M1
5 | import Effect.Console (log)
6 |
7 | testX = X
8 |
9 | -- should fail as Y constructor is not exported from M1
10 | testY = Y
11 |
12 | main = log "Done"
13 |
--------------------------------------------------------------------------------
/tests/purs/failing/ExportExplicit1/M1.purs:
--------------------------------------------------------------------------------
1 | module M1 (X(X)) where
2 |
3 | data X = X | Y
4 |
--------------------------------------------------------------------------------
/tests/purs/failing/ExportExplicit2.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith UnknownExportDataConstructor
2 | -- should fail as Y is not a data constructor for X
3 | module M1 (X(Y)) where
4 |
5 | import Prelude
6 |
7 | data X = X
8 | data Y = Y
9 |
--------------------------------------------------------------------------------
/tests/purs/failing/ExportExplicit3.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith UnknownName
2 | module Main where
3 |
4 | import M1 as M
5 | import Effect.Console (log)
6 |
7 | -- should fail as Z is not exported from M1
8 | testZ = M.Z
9 |
10 | main = log "Done"
11 |
--------------------------------------------------------------------------------
/tests/purs/failing/ExportExplicit3/M1.purs:
--------------------------------------------------------------------------------
1 | module M1 (X(..)) where
2 |
3 | data X = X | Y
4 | data Z = Z
5 |
--------------------------------------------------------------------------------
/tests/purs/failing/ExtraRecordField.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith AdditionalProperty
2 | module ExtraRecordField where
3 |
4 | import Prelude ((<>))
5 |
6 | full :: { first :: String, last :: String } -> String
7 | full p = p.first <> " " <> p.last
8 |
9 | oops = full { first: "Jane", last: "Smith", age: 29 }
10 |
--------------------------------------------------------------------------------
/tests/purs/failing/ExtraneousClassMember.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith ExtraneousClassMember
2 | module Main where
3 |
4 | import Prelude
5 |
6 | class A a where
7 | a :: a -> String
8 |
9 | instance aString :: A String where
10 | a s = s
11 | b x = x
12 |
--------------------------------------------------------------------------------
/tests/purs/failing/Generalization1.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith CannotGeneralizeRecursiveFunction
2 | module Main where
3 |
4 | import Prelude
5 |
6 | foo 0 x _ = x
7 | foo n x y = x <> bar (n - 1) x y
8 |
9 | bar 0 x _ = x
10 | bar n x y = y <> foo (n - 1) x y
11 |
12 |
--------------------------------------------------------------------------------
/tests/purs/failing/Generalization2.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith CannotGeneralizeRecursiveFunction
2 | module Main where
3 |
4 | import Prelude
5 |
6 | test n m | n <= 1 = m
7 | | otherwise = test (n - 1) (m <> m)
8 |
9 |
--------------------------------------------------------------------------------
/tests/purs/failing/ImportExplicit.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith UnknownImport
2 | module Main where
3 |
4 | import M1 (X(..))
5 |
--------------------------------------------------------------------------------
/tests/purs/failing/ImportExplicit/M1.purs:
--------------------------------------------------------------------------------
1 | module M1 where
2 |
3 | foo = "foo"
4 |
--------------------------------------------------------------------------------
/tests/purs/failing/ImportExplicit2.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith UnknownImportDataConstructor
2 | module Main where
3 |
4 | import M1 (X(Z, Q))
5 |
--------------------------------------------------------------------------------
/tests/purs/failing/ImportExplicit2/M1.purs:
--------------------------------------------------------------------------------
1 | module M1 where
2 |
3 | data X = Y
4 |
--------------------------------------------------------------------------------
/tests/purs/failing/ImportHidingModule.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith ErrorParsingModule
2 | module Main where
3 |
4 | import B hiding (module A)
5 |
--------------------------------------------------------------------------------
/tests/purs/failing/ImportHidingModule/A.purs:
--------------------------------------------------------------------------------
1 | module A where
2 | x = 1
3 |
--------------------------------------------------------------------------------
/tests/purs/failing/ImportHidingModule/B.purs:
--------------------------------------------------------------------------------
1 | module B (module B, module A) where
2 | import A
3 | y = 1
4 |
--------------------------------------------------------------------------------
/tests/purs/failing/ImportModule.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith ModuleNotFound
2 | module Main where
3 |
4 | import M1
5 |
--------------------------------------------------------------------------------
/tests/purs/failing/ImportModule/M2.purs:
--------------------------------------------------------------------------------
1 | module M2 where
2 |
3 | data X = X
4 |
--------------------------------------------------------------------------------
/tests/purs/failing/InfiniteKind.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith InfiniteKind
2 |
3 | module Main where
4 |
5 | data F a = F (a a)
6 |
--------------------------------------------------------------------------------
/tests/purs/failing/InfiniteKind2.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith InfiniteKind
2 |
3 | module InfiniteKind2 where
4 |
5 | data Tree m a = Tree a (m (Tree a))
6 |
--------------------------------------------------------------------------------
/tests/purs/failing/InfiniteType.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith InfiniteType
2 |
3 | module Main where
4 |
5 | f a = a a
6 |
--------------------------------------------------------------------------------
/tests/purs/failing/InstanceExport.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith TransitiveExportError
2 | module Test where
3 |
4 | import InstanceExport
5 | import Prelude
6 |
7 | test = f $ S "Test"
8 |
--------------------------------------------------------------------------------
/tests/purs/failing/InstanceExport/InstanceExport.purs:
--------------------------------------------------------------------------------
1 | module InstanceExport (S(..), f) where
2 |
3 | import Prelude
4 |
5 | newtype S = S String
6 |
7 | class F a where
8 | f :: a -> String
9 |
10 | instance fs :: F S where
11 | f (S s) = s
12 |
--------------------------------------------------------------------------------
/tests/purs/failing/InstanceSigsBodyIncorrect.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith TypesDoNotUnify
2 |
3 | module Main where
4 |
5 | class Foo a where
6 | foo :: a
7 |
8 | instance fooNumber :: Foo Number where
9 | foo :: Number
10 | foo = true
11 |
--------------------------------------------------------------------------------
/tests/purs/failing/InstanceSigsDifferentTypes.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith TypesDoNotUnify
2 |
3 | module Main where
4 |
5 | class Foo a where
6 | foo :: a
7 |
8 | instance fooNumber :: Foo Number where
9 | foo :: Int
10 | foo = 0.0
11 |
--------------------------------------------------------------------------------
/tests/purs/failing/InstanceSigsIncorrectType.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith TypesDoNotUnify
2 |
3 | module Main where
4 |
5 | class Foo a where
6 | foo :: a
7 |
8 | instance fooNumber :: Foo Number where
9 | foo :: Boolean
10 | foo = true
11 |
--------------------------------------------------------------------------------
/tests/purs/failing/InstanceSigsOrphanTypeDeclaration.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith OrphanTypeDeclaration
2 |
3 | module Main where
4 |
5 | class Foo a where
6 | foo :: a
7 |
8 | instance fooNumber :: Foo Number where
9 | bar :: Int
10 | foo = 0.0
11 |
--------------------------------------------------------------------------------
/tests/purs/failing/IntOutOfRange.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith IntOutOfRange
2 |
3 | module Main where
4 |
5 | n :: Int
6 | n = 2147483648
7 |
--------------------------------------------------------------------------------
/tests/purs/failing/InvalidDerivedInstance.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith InvalidDerivedInstance
2 | module Main where
3 |
4 | import Prelude
5 |
6 | data X = X
7 |
8 | derive instance eqX :: Eq X X
9 |
--------------------------------------------------------------------------------
/tests/purs/failing/InvalidDerivedInstance2.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith ExpectedTypeConstructor
2 | module Main where
3 |
4 | import Prelude
5 |
6 | derive instance eqRecord :: Eq {}
7 |
--------------------------------------------------------------------------------
/tests/purs/failing/InvalidOperatorInBinder.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith InvalidOperatorInBinder
2 | module Main where
3 |
4 | data List a = Cons a (List a) | Nil
5 |
6 | cons ∷ ∀ a. a → List a → List a
7 | cons = Cons
8 |
9 | infixl 6 cons as :
10 |
11 | get ∷ ∀ a. List a → a
12 | get (_ : x : _) = x
13 |
--------------------------------------------------------------------------------
/tests/purs/failing/KindError.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith KindsDoNotUnify
2 | module Main where
3 |
4 | import Prelude
5 |
6 | data KindError f a = One f | Two (f a)
7 |
--------------------------------------------------------------------------------
/tests/purs/failing/KindStar.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith ExpectedType
2 |
3 | module X where
4 |
5 | data List a = Nil | Cons a (List a)
6 |
7 | test :: List
8 | test = Nil
9 |
--------------------------------------------------------------------------------
/tests/purs/failing/LacksWithSubGoal.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith NoInstanceFound
2 | module LacksWithSubGoal where
3 |
4 | import Prim.Row (class Lacks)
5 |
6 | data S (r :: Symbol) = S
7 |
8 | data R (r :: # Type) = R
9 |
10 | union :: forall s r. Lacks s r => S s -> R r
11 | union S = R
12 |
13 | example :: forall r. R (k :: Int | r)
14 | example = union (S :: S "hello")
15 |
16 |
17 |
--------------------------------------------------------------------------------
/tests/purs/failing/LeadingZeros1.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith ErrorParsingModule
2 | module Main where
3 |
4 | import Prelude
5 |
6 | x = 01
7 |
--------------------------------------------------------------------------------
/tests/purs/failing/LeadingZeros2.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith ErrorParsingModule
2 | module Main where
3 |
4 | import Prelude
5 |
6 | x = 00.1
7 |
--------------------------------------------------------------------------------
/tests/purs/failing/Let.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith CycleInDeclaration
2 | module Main where
3 |
4 | import Prelude
5 |
6 | test = let x = x in x
7 |
--------------------------------------------------------------------------------
/tests/purs/failing/LetPatterns1.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith ErrorParsingModule
2 | module Main where
3 |
4 | import Prelude
5 |
6 | -- wrong binders for function, the first one should be VarBinder
7 | x =
8 | let (X a b) x y = hoge
9 | in
10 | a
11 |
--------------------------------------------------------------------------------
/tests/purs/failing/LetPatterns2.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith UnknownName
2 | module Main where
3 |
4 | import Prelude
5 |
6 | data X a = X a
7 |
8 | -- wrong dependency order
9 | x =
10 | let
11 | b = a
12 | X a = X 10
13 | in
14 | b
15 |
--------------------------------------------------------------------------------
/tests/purs/failing/LetPatterns3.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith IncorrectConstructorArity
2 | module Main where
3 |
4 | import Prelude
5 |
6 | data X a = X a
7 |
8 | -- a parameter binder should be with nullary constructor, or with parens
9 | x =
10 | let
11 | a X b = b
12 | in
13 | a $ X 10
14 |
--------------------------------------------------------------------------------
/tests/purs/failing/LetPatterns4.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith ErrorParsingModule
2 | module Main where
3 |
4 | data X a = X a
5 |
6 | X a = a
7 |
--------------------------------------------------------------------------------
/tests/purs/failing/MPTCs.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith ClassInstanceArityMismatch
2 | module Main where
3 |
4 | import Prelude
5 |
6 | class Foo a where
7 | f :: a -> a
8 |
9 | instance fooStringString :: Foo String String where
10 | f a = a
11 |
--------------------------------------------------------------------------------
/tests/purs/failing/MissingClassExport.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith TransitiveExportError
2 | module Test (bar) where
3 |
4 | import Prelude
5 |
6 | class Foo a where
7 | bar :: a -> a
8 |
--------------------------------------------------------------------------------
/tests/purs/failing/MissingClassMember.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith MissingClassMember
2 | module Main where
3 |
4 | class A a where
5 | a :: a -> String
6 | b :: a -> Number
7 | c :: forall f. a -> f a
8 |
9 | instance aString :: A String where
10 | a s = s
11 |
--------------------------------------------------------------------------------
/tests/purs/failing/MissingClassMemberExport.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith TransitiveExportError
2 | module Test (class Foo) where
3 |
4 | import Prelude
5 |
6 | class Foo a where
7 | bar :: a -> a
8 |
--------------------------------------------------------------------------------
/tests/purs/failing/MissingFFIImplementations.js:
--------------------------------------------------------------------------------
1 | exports.yes = true;
2 |
--------------------------------------------------------------------------------
/tests/purs/failing/MissingFFIImplementations.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith MissingFFIImplementations
2 | module Main where
3 |
4 | foreign import yes :: Boolean
5 | foreign import no :: Boolean
6 |
--------------------------------------------------------------------------------
/tests/purs/failing/MissingRecordField.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith PropertyIsMissing
2 | module MissingRecordField where
3 |
4 | import Prelude ((>))
5 |
6 | john = { first: "John", last: "Smith" }
7 |
8 | isOver50 p = p.age > 50.0
9 |
10 | result = isOver50 john
11 |
--------------------------------------------------------------------------------
/tests/purs/failing/MixedAssociativityError.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith MixedAssociativityError
2 | module Main where
3 |
4 | import Prelude
5 |
6 | feq f x y = f <$> x == f <$> y
7 |
--------------------------------------------------------------------------------
/tests/purs/failing/MultipleErrors.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith TypesDoNotUnify
2 | -- @shouldFailWith TypesDoNotUnify
3 | module MultipleErrors where
4 |
5 | import Prelude
6 |
7 | foo :: Int -> Int
8 | foo 0 = "Test"
9 | foo n = bar (n - 1)
10 |
11 | bar :: Int -> Int
12 | bar 0 = "Test"
13 | bar n = foo (n - 1)
14 |
--------------------------------------------------------------------------------
/tests/purs/failing/MultipleErrors2.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith UnknownName
2 | -- @shouldFailWith UnknownName
3 | module MultipleErrors2 where
4 |
5 | import Prelude
6 |
7 | foo = itDoesntExist
8 |
9 | bar = neitherDoesThis
10 |
--------------------------------------------------------------------------------
/tests/purs/failing/MultipleTypeOpFixities.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith MultipleTypeOpFixities
2 | module MultipleTypeOpFixities where
3 |
4 | import Prelude
5 |
6 | type Op x y = Op x y
7 |
8 | infix 2 type Op as !?
9 | infix 2 type Op as !?
10 |
--------------------------------------------------------------------------------
/tests/purs/failing/MultipleValueOpFixities.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith MultipleValueOpFixities
2 | module MultipleValueOpFixities where
3 |
4 | import Prelude
5 |
6 | add x y = x + y
7 |
8 | infix 2 add as !?
9 | infix 2 add as !?
10 |
--------------------------------------------------------------------------------
/tests/purs/failing/MutRec.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith CycleInDeclaration
2 | -- @shouldFailWith CycleInDeclaration
3 | module MutRec where
4 |
5 | import Prelude
6 |
7 | x = y
8 |
9 | y = x
10 |
--------------------------------------------------------------------------------
/tests/purs/failing/MutRec2.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith CycleInDeclaration
2 | module Main where
3 |
4 | import Prelude
5 |
6 | x = x
7 |
--------------------------------------------------------------------------------
/tests/purs/failing/NewtypeInstance.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith InvalidNewtypeInstance
2 | module Main where
3 |
4 | import Prelude
5 |
6 | data X = X
7 |
8 | derive newtype instance showX :: Show X
9 |
--------------------------------------------------------------------------------
/tests/purs/failing/NewtypeInstance2.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith InvalidNewtypeInstance
2 | module Main where
3 |
4 | import Prelude
5 |
6 | data X a = X a a
7 |
8 | derive newtype instance showX :: Show a => Show (X a)
9 |
--------------------------------------------------------------------------------
/tests/purs/failing/NewtypeInstance3.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith InvalidNewtypeInstance
2 | module Main where
3 |
4 | import Prelude
5 |
6 | class Nullary
7 |
8 | derive newtype instance nullary :: Nullary
9 |
--------------------------------------------------------------------------------
/tests/purs/failing/NewtypeInstance4.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith InvalidNewtypeInstance
2 | module Main where
3 |
4 | import Prelude
5 |
6 | data X = X | Y
7 |
8 | derive newtype instance showX :: Show X
9 |
--------------------------------------------------------------------------------
/tests/purs/failing/NewtypeInstance5.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith InvalidNewtypeInstance
2 | module Main where
3 |
4 | import Prelude
5 |
6 | newtype X a = X a
7 |
8 | derive newtype instance functorX :: Functor X
9 |
--------------------------------------------------------------------------------
/tests/purs/failing/NewtypeInstance6.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith InvalidNewtypeInstance
2 | module Main where
3 |
4 | import Prelude
5 |
6 | newtype X a b = X (Array b)
7 |
8 | derive newtype instance functorX :: Functor X
9 |
--------------------------------------------------------------------------------
/tests/purs/failing/NewtypeMultiArgs.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith ErrorParsingModule
2 | module Main where
3 |
4 | import Prelude
5 |
6 | newtype Thing = Thing String Boolean
7 |
--------------------------------------------------------------------------------
/tests/purs/failing/NewtypeMultiCtor.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith ErrorParsingModule
2 | module Main where
3 |
4 | import Prelude
5 |
6 | newtype Thing = Thing String | Other
7 |
--------------------------------------------------------------------------------
/tests/purs/failing/NonAssociativeError.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith NonAssociativeError
2 | -- @shouldFailWith NonAssociativeError
3 | module Main where
4 |
5 | import Prelude
6 |
7 | a = true == true == true
8 | b = true == false /= true
9 |
--------------------------------------------------------------------------------
/tests/purs/failing/NonExhaustivePatGuard.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith NoInstanceFound
2 | module Main where
3 |
4 | f :: Int -> Int
5 | f x | 1 <- x = x
6 |
--------------------------------------------------------------------------------
/tests/purs/failing/NullaryAbs.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith ErrorParsingModule
2 | module Main where
3 |
4 | import Prelude
5 |
6 | func = \ -> "no"
7 |
--------------------------------------------------------------------------------
/tests/purs/failing/Object.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith PropertyIsMissing
2 | module Main where
3 |
4 | import Prelude
5 |
6 | test o = o.foo
7 |
8 | test1 = test {}
9 |
--------------------------------------------------------------------------------
/tests/purs/failing/OperatorAliasNoExport.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith TransitiveExportError
2 | module Test ((?!)) where
3 |
4 | infixl 4 what as ?!
5 |
6 | what :: forall a b. a -> b -> a
7 | what a _ = a
8 |
--------------------------------------------------------------------------------
/tests/purs/failing/OperatorAt.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith ErrorParsingModule
2 | module Main where
3 |
4 | import Prelude
5 |
6 | infix 1 const as @
7 |
8 | test = 1 @ 2
9 |
--------------------------------------------------------------------------------
/tests/purs/failing/OperatorBackslash.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith ErrorParsingModule
2 | module Main where
3 |
4 | import Prelude
5 |
6 | infix 1 const as \
7 |
8 | test = 1 \ 2
9 |
--------------------------------------------------------------------------------
/tests/purs/failing/OperatorSections.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith TypesDoNotUnify
2 | module Main where
3 |
4 | import Prelude
5 |
6 | main = do
7 | (true `not` _)
8 |
--------------------------------------------------------------------------------
/tests/purs/failing/OrphanInstance.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith OrphanInstance
2 | module Test where
3 |
4 | import Class
5 |
6 | instance cBoolean :: C Boolean where
7 | op a = a
8 |
--------------------------------------------------------------------------------
/tests/purs/failing/OrphanInstance/Class.purs:
--------------------------------------------------------------------------------
1 | module Class where
2 |
3 | class C a where
4 | op :: a -> a
5 |
--------------------------------------------------------------------------------
/tests/purs/failing/OrphanInstanceFunDepCycle.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith OrphanInstance
2 | module Main where
3 | import Lib
4 | data L
5 | instance clr :: C L R
6 |
--------------------------------------------------------------------------------
/tests/purs/failing/OrphanInstanceFunDepCycle/Lib.purs:
--------------------------------------------------------------------------------
1 | module Lib where
2 | -- covering sets: {{l}, {r}}
3 | class C l r | l -> r, r -> l
4 | data R
5 |
--------------------------------------------------------------------------------
/tests/purs/failing/OrphanInstanceNullary.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith OrphanInstance
2 | module Test where
3 | import Lib
4 | instance c :: C
5 |
--------------------------------------------------------------------------------
/tests/purs/failing/OrphanInstanceNullary/Lib.purs:
--------------------------------------------------------------------------------
1 | module Lib where
2 | class C
3 |
--------------------------------------------------------------------------------
/tests/purs/failing/OrphanInstanceWithDetermined.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith OrphanInstance
2 | module Main where
3 | import Lib
4 | data R
5 | instance cflr :: C F L R
6 |
--------------------------------------------------------------------------------
/tests/purs/failing/OrphanInstanceWithDetermined/Lib.purs:
--------------------------------------------------------------------------------
1 | module Lib where
2 | -- covering sets: {{f, l}}
3 | class C f l r | l -> r
4 | data F
5 | data L
6 |
--------------------------------------------------------------------------------
/tests/purs/failing/OrphanTypeDecl.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith OrphanTypeDeclaration
2 | module OrphanTypeDecl where
3 |
4 | fn :: Number -> Boolean
5 |
--------------------------------------------------------------------------------
/tests/purs/failing/OverlapAcrossModules.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith OverlappingInstances
2 | module OverlapAcrossModules where
3 | import OverlapAcrossModules.Class
4 | import OverlapAcrossModules.X
5 | data Y
6 | instance cxy :: C X Y
7 |
8 |
--------------------------------------------------------------------------------
/tests/purs/failing/OverlapAcrossModules/Class.purs:
--------------------------------------------------------------------------------
1 | module OverlapAcrossModules.Class where
2 | class C x y
3 |
--------------------------------------------------------------------------------
/tests/purs/failing/OverlapAcrossModules/X.purs:
--------------------------------------------------------------------------------
1 | module OverlapAcrossModules.X where
2 | import OverlapAcrossModules.Class
3 | data X
4 | instance cxy :: C X y
5 |
--------------------------------------------------------------------------------
/tests/purs/failing/OverlappingArguments.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith OverlappingArgNames
2 | module OverlappingArguments where
3 |
4 | import Prelude
5 |
6 | f x x = x
7 |
--------------------------------------------------------------------------------
/tests/purs/failing/OverlappingBinders.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith OverlappingArgNames
2 | module OverlappingBinders where
3 |
4 | import Prelude
5 |
6 | data S a = S a (S a)
7 |
8 | f x = case x of
9 | (S y (S y@(S z zs))) -> y
10 |
--------------------------------------------------------------------------------
/tests/purs/failing/OverlappingVars.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith NoInstanceFound
2 | module Main where
3 |
4 | import Prelude
5 |
6 | class OverlappingVars a where
7 | f :: a -> a
8 |
9 | data Foo a b = Foo a b
10 |
11 | instance overlappingVarsFoo :: OverlappingVars (Foo a a) where
12 | f a = a
13 |
14 | test = f (Foo "" 0)
15 |
--------------------------------------------------------------------------------
/tests/purs/failing/PrimModuleReserved.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith CannotDefinePrimModules
2 | module Main where
3 |
4 | import Prim
5 |
--------------------------------------------------------------------------------
/tests/purs/failing/PrimModuleReserved/Prim.purs:
--------------------------------------------------------------------------------
1 | module Prim where
2 |
--------------------------------------------------------------------------------
/tests/purs/failing/PrimRow.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith UnknownName
2 | module Main where
3 |
4 | import Prelude
5 |
6 | -- The 'Cons' class is not imported here, so we should not be able to refer to
7 | -- it in the module.
8 | x :: Cons "hello" Int () ("hello" :: Int)
9 | => Unit
10 | x = unit
11 |
12 |
--------------------------------------------------------------------------------
/tests/purs/failing/PrimSubModuleReserved.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith CannotDefinePrimModules
2 | module Main where
3 |
4 | import Prim.Foobar
5 |
--------------------------------------------------------------------------------
/tests/purs/failing/PrimSubModuleReserved/Prim_Foobar.purs:
--------------------------------------------------------------------------------
1 | module Prim.Foobar where
2 |
--------------------------------------------------------------------------------
/tests/purs/failing/Rank2Types.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith TypesDoNotUnify
2 | module Main where
3 |
4 | import Prelude
5 |
6 | foreign import test :: (forall a. a -> a) -> Number
7 |
8 | test1 = test (\n -> n + 1)
9 |
--------------------------------------------------------------------------------
/tests/purs/failing/RequiredHiddenType.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith TransitiveExportError
2 | -- exporting `a` should fail as `A` is hidden
3 | module Foo (B(..), a, b) where
4 |
5 | data A = A
6 | data B = B
7 |
8 | a = A
9 | b = B
10 |
--------------------------------------------------------------------------------
/tests/purs/failing/Reserved.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith ErrorParsingModule
2 | module Main where
3 |
4 | import Prelude
5 |
6 | (<) :: Number -> Number -> Number
7 | (<) a b = !(a >= b)
8 |
--------------------------------------------------------------------------------
/tests/purs/failing/RowConstructors1.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith KindsDoNotUnify
2 | module Main where
3 |
4 | import Effect.Console (log)
5 |
6 | data Foo = Bar
7 | type Baz = { | Foo }
8 |
9 | main = log "Done"
10 |
--------------------------------------------------------------------------------
/tests/purs/failing/RowConstructors2.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith KindsDoNotUnify
2 | module Main where
3 |
4 | import Effect.Console (log)
5 |
6 | type Foo r = (x :: Number | r)
7 | type Bar = { | Foo }
8 |
9 | main = log "Done"
10 |
--------------------------------------------------------------------------------
/tests/purs/failing/RowConstructors3.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith KindsDoNotUnify
2 | module Main where
3 |
4 | import Effect.Console (log)
5 |
6 | type Foo = { x :: Number }
7 | type Bar = { | Foo }
8 |
9 | main = log "Done"
10 |
--------------------------------------------------------------------------------
/tests/purs/failing/RowInInstanceNotDetermined0.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith InvalidInstanceHead
2 | module Main where
3 |
4 | import Prelude
5 |
6 | -- no fundeps
7 | class C a b
8 | instance c :: C Unit {}
9 |
10 |
--------------------------------------------------------------------------------
/tests/purs/failing/RowInInstanceNotDetermined1.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith InvalidInstanceHead
2 | module Main where
3 |
4 | import Prelude
5 |
6 | -- `c` not mentioned in any fundeps
7 | class C a b c | a -> b
8 | instance c :: C Unit Unit {}
9 |
10 |
--------------------------------------------------------------------------------
/tests/purs/failing/RowInInstanceNotDetermined2.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith InvalidInstanceHead
2 | module Main where
3 |
4 | import Prelude
5 |
6 | -- `b` isn't determined by anything that `b` doesn't determine
7 | class C a b | a -> b, b -> a
8 | instance c :: C Unit {}
9 |
10 |
--------------------------------------------------------------------------------
/tests/purs/failing/SelfImport.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith CycleInModules
2 |
3 | module Main where
4 |
5 | import Main as M
6 |
7 | foo = 0
8 |
9 | bar = M.foo
10 |
--------------------------------------------------------------------------------
/tests/purs/failing/SelfImport/Dummy.purs:
--------------------------------------------------------------------------------
1 | -- This module only exists so that we perform a full build for the
2 | -- SelfImport.purs module. If this module didn't exist, we would perform a
3 | -- single-module fast rebuild, which doesn't perform the `sortModules` step,
4 | -- and so the error we want to see wouldn't be emitted.
5 | module Dummy where
6 |
--------------------------------------------------------------------------------
/tests/purs/failing/SkolemEscape.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith EscapedSkolem
2 | module Main where
3 |
4 | import Prelude
5 |
6 | foreign import foo :: (forall a. a -> a) -> Number
7 |
8 | test = \x -> foo x
9 |
--------------------------------------------------------------------------------
/tests/purs/failing/SkolemEscape2.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith EscapedSkolem
2 | module Main where
3 |
4 | import Prelude
5 | import Effect
6 | import Control.Monad.ST as ST
7 | import Control.Monad.ST.Ref as STRef
8 |
9 | test _ = do
10 | r <- pure (ST.run (STRef.new 0))
11 | pure r
12 |
--------------------------------------------------------------------------------
/tests/purs/failing/SuggestComposition.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith TypesDoNotUnify
2 | -- TODO: Ensure the correct suggestion is produced.
3 | module SuggestComposition where
4 |
5 | import Prelude
6 |
7 | f = g . g where g = (_ + 1)
8 |
--------------------------------------------------------------------------------
/tests/purs/failing/Superclasses1.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith NoInstanceFound
2 | module Main where
3 |
4 | import Prelude
5 |
6 | class Su a where
7 | su :: a -> a
8 |
9 | class (Su a) <= Cl a where
10 | cl :: a -> a -> a
11 |
12 | instance clNumber :: Cl Number where
13 | cl n m = n + m
14 |
15 |
--------------------------------------------------------------------------------
/tests/purs/failing/Superclasses2.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith CycleInTypeClassDeclaration
2 | module CycleInSuperclasses where
3 |
4 | import Prelude
5 |
6 | class (Foo a) <= Bar a
7 |
8 | class (Bar a) <= Foo a
9 |
10 | instance barString :: Bar String
11 |
12 | instance fooString :: Foo String
13 |
--------------------------------------------------------------------------------
/tests/purs/failing/Superclasses3.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith UndefinedTypeVariable
2 | module UnknownSuperclassTypeVar where
3 |
4 | import Prelude
5 |
6 | class Foo a
7 |
8 | class (Foo b) <= Bar a
9 |
--------------------------------------------------------------------------------
/tests/purs/failing/TooFewClassInstanceArgs.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith ClassInstanceArityMismatch
2 | module Main where
3 |
4 | import Prelude
5 |
6 | class Foo a b
7 |
8 | instance fooString :: Foo String
9 |
--------------------------------------------------------------------------------
/tests/purs/failing/TopLevelCaseNoArgs.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith DuplicateValueDeclaration
2 | module Main where
3 |
4 | import Prelude
5 |
6 | foo :: Number
7 | foo = 1
8 | foo = 2
9 |
--------------------------------------------------------------------------------
/tests/purs/failing/TransitiveDctorExport.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith TransitiveExportError
2 | module Main (Y(..)) where
3 |
4 | type X = Int
5 | data Y = Y X
6 |
--------------------------------------------------------------------------------
/tests/purs/failing/TransitiveKindExport.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith TransitiveExportError
2 | module Main (TestProxy(..)) where
3 |
4 | foreign import kind Test
5 |
6 | data TestProxy (p :: Test) = TestProxy
7 |
--------------------------------------------------------------------------------
/tests/purs/failing/TransitiveSynonymExport.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith TransitiveExportError
2 | module Main (Y()) where
3 |
4 | type X = Int
5 | type Y = X
6 |
--------------------------------------------------------------------------------
/tests/purs/failing/TypeClasses2.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith NoInstanceFound
2 | module Main where
3 |
4 | class Show a where
5 | show :: a -> String
6 |
7 | test = show "testing"
8 |
--------------------------------------------------------------------------------
/tests/purs/failing/TypeError.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith TypesDoNotUnify
2 | module Main where
3 |
4 | import Prelude
5 |
6 | test = 1 <> "A"
7 |
--------------------------------------------------------------------------------
/tests/purs/failing/TypeOperatorAliasNoExport.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith TransitiveExportError
2 | module Test (type (×)) where
3 |
4 | data Tuple a b = Tuple a b
5 |
6 | infixl 6 type Tuple as ×
7 |
--------------------------------------------------------------------------------
/tests/purs/failing/TypeSynonyms.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith CycleInTypeSynonym
2 | module Main where
3 |
4 | import Prelude
5 |
6 | type T1 = Array T2
7 |
8 | type T2 = T1
9 |
--------------------------------------------------------------------------------
/tests/purs/failing/TypeSynonyms2.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith TypeSynonymInstance
2 | module Main where
3 |
4 | import Prelude
5 |
6 | class Foo a where
7 | foo :: a -> String
8 |
9 | type Bar = String
10 |
11 | instance fooBar :: Foo Bar where
12 | foo s = s
13 |
--------------------------------------------------------------------------------
/tests/purs/failing/TypeSynonyms3.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith TypeSynonymInstance
2 | module Main where
3 |
4 | import Prelude
5 |
6 | class Foo a where
7 | foo :: a -> String
8 |
9 | type Bar = String
10 |
11 | instance fooBar :: Foo Bar where
12 | foo s = s
13 |
--------------------------------------------------------------------------------
/tests/purs/failing/TypeSynonyms4.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith PartiallyAppliedSynonym
2 | module TypeSynonyms4 where
3 |
4 | import Prelude
5 |
6 | type F x y = x -> y
7 |
8 | type G x = F x
9 |
10 | f :: G String String -> String
11 | f k = k "Done"
12 |
--------------------------------------------------------------------------------
/tests/purs/failing/TypeSynonyms5.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith CycleInTypeSynonym
2 | module Main where
3 |
4 | import Prelude
5 |
6 | type T = T
7 |
--------------------------------------------------------------------------------
/tests/purs/failing/TypeWildcards1.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith ErrorParsingModule
2 | module TypeWildcards where
3 |
4 | import Prelude
5 |
6 | type Test = _
7 |
8 |
--------------------------------------------------------------------------------
/tests/purs/failing/TypeWildcards2.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith ErrorParsingModule
2 | module TypeWildcards where
3 |
4 | import Prelude
5 |
6 | data Test = Test _
7 |
8 |
--------------------------------------------------------------------------------
/tests/purs/failing/TypeWildcards3.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith InvalidInstanceHead
2 | module TypeWildcards where
3 |
4 | import Prelude
5 |
6 | data Foo a = Foo
7 |
8 | instance showFoo :: Show (Foo _) where
9 | show Foo = "Foo"
10 |
--------------------------------------------------------------------------------
/tests/purs/failing/TypedBinders.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith ErrorParsingModule
2 | module Main where
3 |
4 | import Effect.Console (log)
5 |
6 | test = (\f :: Int -> Int -> f 10) identity
7 |
8 | main = do
9 | let t1 = test
10 | log "Done"
11 |
--------------------------------------------------------------------------------
/tests/purs/failing/TypedBinders2.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith TypesDoNotUnify
2 | module Main where
3 |
4 | import Prelude
5 | import Effect.Console (log)
6 |
7 | main = do
8 | s :: String <- log "Foo"
9 | log "Done"
10 |
--------------------------------------------------------------------------------
/tests/purs/failing/TypedBinders3.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith TypesDoNotUnify
2 | module Main where
3 |
4 | import Prelude
5 | import Effect.Console (log)
6 |
7 | test = case 1 of
8 | (0 :: String) -> true
9 | _ -> false
10 |
11 | main = do
12 | let t = test
13 | log "Done"
14 |
--------------------------------------------------------------------------------
/tests/purs/failing/TypedHole.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith HoleInferredType
2 | module Main where
3 |
4 | import Prelude
5 | import Effect (Effect)
6 |
7 | main :: Effect Unit
8 | main = ?ummm
9 |
--------------------------------------------------------------------------------
/tests/purs/failing/TypedHole2.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith HoleInferredType
2 | module Main where
3 |
4 | import Prelude
5 | import Effect (Effect)
6 |
7 | main :: Effect ?ummm
8 | main = pure unit
9 |
--------------------------------------------------------------------------------
/tests/purs/failing/UnderscoreModuleName.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith ErrorParsingModule
2 | module Bad_Module where
3 |
4 | import Effect.Console (log)
5 |
6 | main = log "Done"
7 |
--------------------------------------------------------------------------------
/tests/purs/failing/UnknownType.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith UnknownName
2 | module Main where
3 |
4 | import Prelude
5 |
6 | test :: Number -> Something
7 | test = {}
8 |
--------------------------------------------------------------------------------
/tests/purs/failing/UnusableTypeClassMethod.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith UnusableDeclaration
2 | module Main where
3 |
4 | class C a b where
5 | -- type doesn't contain `a`, which is also required to determine an instance
6 | c :: b
7 |
8 |
--------------------------------------------------------------------------------
/tests/purs/failing/UnusableTypeClassMethodConflictingIdent.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith UnusableDeclaration
2 | module Main where
3 |
4 | class C a where
5 | -- type doesn't contain the type class var `a`
6 | c :: forall a. a
7 |
8 |
--------------------------------------------------------------------------------
/tests/purs/failing/UnusableTypeClassMethodSynonym.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith UnusableDeclaration
2 | module Main where
3 |
4 | type M x = forall a. a
5 |
6 | class C a where
7 | -- after synonym expansion, the type doesn't actually contain an `a`
8 | c :: M a
9 |
10 |
--------------------------------------------------------------------------------
/tests/purs/failing/Whitespace1.purs:
--------------------------------------------------------------------------------
1 | -- @shouldFailWith ErrorParsingModule
2 | module Main where
3 |
4 | test = do
5 | test
6 |
--------------------------------------------------------------------------------
/tests/purs/layout/.gitattributes:
--------------------------------------------------------------------------------
1 | *.out -merge -text
2 |
--------------------------------------------------------------------------------
/tests/purs/layout/AdoIn.out:
--------------------------------------------------------------------------------
1 | module Test where{
2 |
3 | test = ado{
4 | baz;
5 | let {foo = bar}}
6 | in bar;
7 |
8 | test = ado {}in foo;
9 |
10 | test = ado{
11 | foo <- bar $ let {a = 42 }in a;
12 | baz <- b}
13 | in bar;
14 |
15 | test = ado{
16 | foo;
17 | let {bar = let {a = 42 }in a};
18 | let {baz = 42}}
19 | in bar}
20 |
--------------------------------------------------------------------------------
/tests/purs/layout/AdoIn.purs:
--------------------------------------------------------------------------------
1 | module Test where
2 |
3 | test = ado
4 | baz
5 | let foo = bar
6 | in bar
7 |
8 | test = ado in foo
9 |
10 | test = ado
11 | foo <- bar $ let a = 42 in a
12 | baz <- b
13 | in bar
14 |
15 | test = ado
16 | foo
17 | let bar = let a = 42 in a
18 | let baz = 42
19 | in bar
20 |
--------------------------------------------------------------------------------
/tests/purs/layout/CaseWhere.out:
--------------------------------------------------------------------------------
1 | module Test where{
2 |
3 | test = case foo of{
4 | Nothing -> a
5 | where {a = 12};
6 | Just a -> do{
7 | what}}
8 | where{
9 | foo = bar};
10 |
11 | test = case f of {Foo -> do {that}
12 | where {foo = 12}}}
13 |
--------------------------------------------------------------------------------
/tests/purs/layout/CaseWhere.purs:
--------------------------------------------------------------------------------
1 | module Test where
2 |
3 | test = case foo of
4 | Nothing -> a
5 | where a = 12
6 | Just a -> do
7 | what
8 | where
9 | foo = bar
10 |
11 | test = case f of Foo -> do that
12 | where foo = 12
13 |
--------------------------------------------------------------------------------
/tests/purs/layout/ClassHead.out:
--------------------------------------------------------------------------------
1 | module Test where{
2 |
3 | import Foo (class Foo);
4 |
5 | class Foo a b c d | a -> b, c -> d where{
6 | foo :: Foo};
7 |
8 | class Foo a b c d | a -> b, c -> d;
9 |
10 | instance foo :: Foo}
11 |
--------------------------------------------------------------------------------
/tests/purs/layout/ClassHead.purs:
--------------------------------------------------------------------------------
1 | module Test where
2 |
3 | import Foo (class Foo)
4 |
5 | class Foo a b c d | a -> b, c -> d where
6 | foo :: Foo
7 |
8 | class Foo a b c d | a -> b, c -> d
9 |
10 | instance foo :: Foo
11 |
--------------------------------------------------------------------------------
/tests/purs/layout/Delimiter.out:
--------------------------------------------------------------------------------
1 | module Test where{
2 |
3 | test1 = a;
4 | test2 = {
5 | b
6 | };
7 | test3 = do{
8 | foo;
9 | bar (
10 | baz
11 | ) == 12;
12 | baz};
13 | test4 = c}
14 |
--------------------------------------------------------------------------------
/tests/purs/layout/Delimiter.purs:
--------------------------------------------------------------------------------
1 | module Test where
2 |
3 | test1 = a
4 | test2 = {
5 | b
6 | }
7 | test3 = do
8 | foo
9 | bar (
10 | baz
11 | ) == 12
12 | baz
13 | test4 = c
14 |
--------------------------------------------------------------------------------
/tests/purs/layout/DoLet.out:
--------------------------------------------------------------------------------
1 | module Test where{
2 |
3 | test = do{
4 | let {foo = bar};
5 | foo};
6 |
7 | test = do{
8 | let {foo = bar};
9 | in baz;
10 | foo};
11 |
12 | test = do{
13 | let {foo = bar}
14 | in baz;
15 | foo}}
16 |
--------------------------------------------------------------------------------
/tests/purs/layout/DoLet.purs:
--------------------------------------------------------------------------------
1 | module Test where
2 |
3 | test = do
4 | let foo = bar
5 | foo
6 |
7 | test = do
8 | let foo = bar
9 | in baz
10 | foo
11 |
12 | test = do
13 | let foo = bar
14 | in baz
15 | foo
16 |
--------------------------------------------------------------------------------
/tests/purs/layout/DoOperator.out:
--------------------------------------------------------------------------------
1 | module Test where{
2 |
3 | test = do{
4 | foo;
5 | foo do{
6 | bar}}
7 | <|> bar}
8 |
9 |
--------------------------------------------------------------------------------
/tests/purs/layout/DoOperator.purs:
--------------------------------------------------------------------------------
1 | module Test where
2 |
3 | test = do
4 | foo
5 | foo do
6 | bar
7 | <|> bar
8 |
9 |
--------------------------------------------------------------------------------
/tests/purs/layout/DoWhere.out:
--------------------------------------------------------------------------------
1 | module Test where{
2 |
3 | test =
4 | do{
5 | do {do{
6 | foo }}}where {bar = baz}}
7 |
--------------------------------------------------------------------------------
/tests/purs/layout/DoWhere.purs:
--------------------------------------------------------------------------------
1 | module Test where
2 |
3 | test =
4 | do
5 | do do
6 | foo where bar = baz
7 |
--------------------------------------------------------------------------------
/tests/purs/layout/IfThenElseDo.out:
--------------------------------------------------------------------------------
1 | module Test where{
2 |
3 | foo = do{
4 | if true then
5 | false
6 | else if false then do{
7 | that}
8 | else do{
9 | what};
10 | that}}
11 |
--------------------------------------------------------------------------------
/tests/purs/layout/IfThenElseDo.purs:
--------------------------------------------------------------------------------
1 | module Test where
2 |
3 | foo = do
4 | if true then
5 | false
6 | else if false then do
7 | that
8 | else do
9 | what
10 | that
11 |
--------------------------------------------------------------------------------
/tests/purs/layout/InstanceChainElse.out:
--------------------------------------------------------------------------------
1 | module Test where{
2 |
3 | instance foo :: Foo Int else bar :: Foo String
4 | else baz :: Foo Boolean}
5 |
--------------------------------------------------------------------------------
/tests/purs/layout/InstanceChainElse.purs:
--------------------------------------------------------------------------------
1 | module Test where
2 |
3 | instance foo :: Foo Int else bar :: Foo String
4 | else baz :: Foo Boolean
5 |
--------------------------------------------------------------------------------
/tests/purs/passing/1185.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Effect.Console (log)
4 |
5 | data Person = Person String Boolean
6 |
7 | getName :: Person -> String
8 | getName p = case p of
9 | Person name true -> name
10 | _ -> "Unknown"
11 |
12 | name :: String
13 | name = getName (Person "John Smith" true)
14 |
15 | main = log "Done"
16 |
--------------------------------------------------------------------------------
/tests/purs/passing/1335.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect.Console (log)
5 |
6 | x :: forall a. a -> String
7 | x a = y "Test"
8 | where
9 | y :: forall a. Show a => a -> String
10 | y a = show (a :: a)
11 |
12 | main = do
13 | log (x 0)
14 | log "Done"
15 |
--------------------------------------------------------------------------------
/tests/purs/passing/1570.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Effect.Console (log)
4 |
5 | test :: forall a. a -> a
6 | test = \(x :: a) -> x
7 |
8 | main = log "Done"
9 |
--------------------------------------------------------------------------------
/tests/purs/passing/1664.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect
5 | import Effect.Console
6 |
7 | data Identity a = Identity a
8 |
9 | newtype IdentityEff a = IdentityEff (Effect (Identity a))
10 |
11 | test :: forall a. IdentityEff a -> IdentityEff Unit
12 | test (IdentityEff action) = IdentityEff $ do
13 | (Identity x :: Identity _) <- action
14 | pure $ Identity unit
15 |
16 | main = log "Done"
17 |
--------------------------------------------------------------------------------
/tests/purs/passing/1807.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect.Console (log)
5 |
6 | fn = _.b.c.d
7 | a = {b:{c:{d:2}}}
8 |
9 | d :: Int
10 | d = fn a + a.b.c.d
11 |
12 | main = if fn a + a.b.c.d == 4
13 | then log "Done"
14 | else log "Fail"
15 |
--------------------------------------------------------------------------------
/tests/purs/passing/1881.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Effect.Console (log)
4 |
5 | foo =
6 | 1
7 |
8 | bar
9 | = 2
10 |
11 | baz
12 | =
13 | 3
14 |
15 | qux
16 | =
17 | 3
18 |
19 | main = log "Done"
20 |
--------------------------------------------------------------------------------
/tests/purs/passing/2018.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import A (foo)
5 | import B (Foo(..))
6 | import Effect (Effect)
7 | import Effect.Console (log)
8 |
9 | main :: Effect Unit
10 | main = do
11 | let tmp = foo X
12 | log "Done"
13 |
--------------------------------------------------------------------------------
/tests/purs/passing/2018/A.purs:
--------------------------------------------------------------------------------
1 | module A where
2 |
3 | import B as Main
4 |
5 | -- Prior to the 2018 fix this would be detected as a cycle between A and Main.
6 | foo ∷ Main.Foo → Main.Foo
7 | foo x = x
8 |
--------------------------------------------------------------------------------
/tests/purs/passing/2018/B.purs:
--------------------------------------------------------------------------------
1 | module B where
2 |
3 | data Foo = X | Y
4 |
--------------------------------------------------------------------------------
/tests/purs/passing/2049.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect.Console (log)
5 |
6 | data List a = Cons a (List a) | Nil
7 |
8 | infixr 6 Cons as :
9 |
10 | f :: List { x :: Int, y :: Int } -> Int
11 | f ( r@{ x } : _) = x + r.y
12 | f _ = 0
13 |
14 | main = log "Done"
15 |
--------------------------------------------------------------------------------
/tests/purs/passing/2136.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect.Console (log)
5 |
6 | main =
7 | if (negate (bottom :: Int) > top)
8 | then log "Fail"
9 | else log "Done"
10 |
--------------------------------------------------------------------------------
/tests/purs/passing/2138.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Effect.Console (log)
4 |
5 | import Lib (A(B,C))
6 |
7 | main = log "Done"
8 |
--------------------------------------------------------------------------------
/tests/purs/passing/2138/Lib.purs:
--------------------------------------------------------------------------------
1 | module Lib (A(..), A) where
2 |
3 | data A = B | C
4 |
--------------------------------------------------------------------------------
/tests/purs/passing/2172.js:
--------------------------------------------------------------------------------
1 | exports['a\''] = 0;
2 | exports["\x62\x27"] = 1;
3 | // NOTE: I wanted to use "\c'" here, but langauge-javascript doesn't support it...
4 | exports["c'"] = 2;
5 | exports["\u0064\u0027"] = 3;
6 |
--------------------------------------------------------------------------------
/tests/purs/passing/2172.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Effect.Console (log)
4 |
5 | foreign import a' :: Number
6 | foreign import b' :: Number
7 | foreign import c' :: Number
8 | foreign import d' :: Number
9 |
10 | main = log "Done"
11 |
--------------------------------------------------------------------------------
/tests/purs/passing/2197-1.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Effect.Console
4 | import Prim as P
5 |
6 | type Number = P.Number
7 | type Test = {}
8 |
9 | z :: Number
10 | z = 0.0
11 |
12 | main = log "Done"
13 |
--------------------------------------------------------------------------------
/tests/purs/passing/2197-2.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Effect.Console
4 | import Prim (Int)
5 |
6 | type Number = Int
7 |
8 | z :: Number
9 | z = 0
10 |
11 | main = log "Done"
12 |
--------------------------------------------------------------------------------
/tests/purs/passing/2252.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Effect.Console (log)
4 |
5 | data T a = T
6 |
7 | ti :: T Int
8 | ti = T
9 |
10 | t :: forall a. T a
11 | t = T
12 |
13 | xs = [ti, t, t]
14 |
15 | main = log "Done"
16 |
--------------------------------------------------------------------------------
/tests/purs/passing/2378.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Effect.Console (log)
4 |
5 | class Foo (a :: Symbol)
6 |
7 | instance fooX :: Foo "x"
8 |
9 | main = log "Done"
10 |
--------------------------------------------------------------------------------
/tests/purs/passing/2438.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Effect.Console (log)
4 |
5 | done :: String
6 | done = {"𝌆": "Done"}."𝌆"
7 |
8 | main = log done
9 |
--------------------------------------------------------------------------------
/tests/purs/passing/2609.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Eg (Foo'(Bar'), (:->))
5 | import Effect (Effect)
6 | import Effect.Console (log)
7 |
8 | bar' :: Foo'
9 | bar' = 4 :-> 5
10 |
11 | main :: Effect Unit
12 | main = case bar' of Bar' l r -> log "Done"
13 |
--------------------------------------------------------------------------------
/tests/purs/passing/2609/Eg.purs:
--------------------------------------------------------------------------------
1 | module Eg (Foo'(Bar'), (:->)) where
2 |
3 | data Foo' = Bar' Int Int
4 |
5 | infix 4 Bar' as :->
6 |
7 |
--------------------------------------------------------------------------------
/tests/purs/passing/2616.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect.Console (log)
5 |
6 | newtype F r a = F { x :: a | r }
7 |
8 | unF :: forall r a. F r a -> { x :: a | r }
9 | unF (F x) = x
10 |
11 | derive instance functorF :: Functor (F r)
12 |
13 | main = log (unF (map identity (F { x: "Done", y: 42 }))).x
14 |
--------------------------------------------------------------------------------
/tests/purs/passing/2626.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Effect.Console (log)
4 |
5 | f = \(x :: forall a. a -> a) -> x x
6 |
7 | test1 = (f \x -> x) 1
8 |
9 | g = \(x :: (forall a. a -> a) -> Int) -> x (\y -> y)
10 |
11 | test2 = g \f -> if f true then f 0 else f 1
12 |
13 | main = log "Done"
14 |
--------------------------------------------------------------------------------
/tests/purs/passing/2663.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Prim.TypeError (class Warn, Text)
5 | import Effect.Console (log)
6 |
7 | foo :: forall t. Warn (Text "Example") => t -> t
8 | foo x = x
9 |
10 | main = when (foo 42 == 42) $ log "Done"
11 |
--------------------------------------------------------------------------------
/tests/purs/passing/2756.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Effect (Effect)
4 | import Effect.Console (log)
5 | import Prelude
6 |
7 | pu :: forall i. i -> Effect Unit
8 | pu _ = pure unit
9 |
10 | type C i = { pu :: i -> Effect Unit }
11 |
12 | sampleC :: C Unit
13 | sampleC = { pu: pu }
14 |
15 | newtype Identity a = Id a
16 |
17 | sampleIdC :: Identity (C Unit)
18 | sampleIdC = Id { pu : pu }
19 |
20 | main = log "Done"
21 |
--------------------------------------------------------------------------------
/tests/purs/passing/2787.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect.Console
5 |
6 | main
7 | | between 0 1 2 = log "Fail"
8 | | otherwise = log "Done"
9 |
--------------------------------------------------------------------------------
/tests/purs/passing/2795.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect.Console (log)
5 |
6 | data X = X Int | Y
7 |
8 | x :: X -> Int
9 | x = case _ of
10 | Y -> 0
11 | X n | 1 <- n -> 1
12 | | otherwise -> 2
13 |
14 | main = log "Done"
15 |
--------------------------------------------------------------------------------
/tests/purs/passing/2803.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude ((+), (-), (==))
4 | import Effect.Console (log)
5 |
6 | f :: Int -> Int -> Int
7 | f = (+)
8 |
9 | infixl 6 f as %
10 |
11 | g :: Int -> Int -> Int
12 | g a b = let f = (-) in a % b
13 |
14 | main =
15 | if g 10 5 == 15
16 | then log "Done"
17 | else log "Failed"
18 |
--------------------------------------------------------------------------------
/tests/purs/passing/2806.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect.Console (log)
5 |
6 | data Stream a = Cons a (Stream a)
7 |
8 | step :: forall a. Stream a -> Stream a
9 | step (Cons _ xs) = xs
10 |
11 | head :: forall a. Stream a -> a
12 | head xs | Cons x _ <- step xs = x
13 |
14 | main = log "Done"
15 |
--------------------------------------------------------------------------------
/tests/purs/passing/2947.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect.Console (log)
5 |
6 | data Foo = Foo
7 |
8 | instance eqFoo :: Eq Foo where
9 | eq _ _ = true
10 |
11 | main = log "Done"
12 |
--------------------------------------------------------------------------------
/tests/purs/passing/2958.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Effect.Console
4 |
5 | data Nil
6 | data Snoc xs x
7 |
8 | infixl 1 type Snoc as :>
9 |
10 | type One = Nil :> Int
11 | type Two = Nil :> Int :> Int
12 | type Three = Nil :> Int :> Int :> Int
13 |
14 | main = log "Done"
15 |
--------------------------------------------------------------------------------
/tests/purs/passing/2972.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Effect.Console (log)
4 | import Prelude (class Show, show)
5 |
6 | type I t = t
7 |
8 | newtype Id t = Id t
9 |
10 | instance foo :: Show (I t) => Show (Id t) where
11 | show (Id t) = "Done"
12 |
13 | main = log (show (Id "other"))
14 |
--------------------------------------------------------------------------------
/tests/purs/passing/3125.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Data.Monoid (class Monoid, mempty)
5 | import Effect.Console (log, logShow)
6 |
7 | data B a = B a a
8 |
9 | memptyB :: forall a b. Monoid b => B (a -> b)
10 | memptyB = B l r where
11 | l _ = mempty
12 | r _ = mempty
13 |
14 | main = do
15 | logShow $ case (memptyB :: B (Int -> Array Unit)) of B l r -> l 0 == r 0
16 | log "Done"
17 |
--------------------------------------------------------------------------------
/tests/purs/passing/3187-UnusedNameClash.purs:
--------------------------------------------------------------------------------
1 | module Main (main) where
2 |
3 | import Prelude ((+))
4 | import Effect.Console (log)
5 |
6 | -- the __unused parameter used to get optimized away
7 | abuseUnused :: forall a. a -> a
8 | abuseUnused __unused = __unused
9 |
10 | main = do
11 | let explode = abuseUnused 0 + abuseUnused 0
12 | log "Done"
13 |
--------------------------------------------------------------------------------
/tests/purs/passing/3388.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect.Console (log)
5 |
6 | main = do
7 | let
8 | x = { a: 42, b: "foo" }
9 | { a, b } = x { a = 43 }
10 | log "Done"
11 |
--------------------------------------------------------------------------------
/tests/purs/passing/3410.purs:
--------------------------------------------------------------------------------
1 | module Main
2 | ( module Prelude
3 | , module DEN
4 | , main
5 | ) where
6 |
7 | import Prelude
8 | import Data.Either.Nested (type (\/)) as DEN
9 | import Effect.Console (log)
10 |
11 | main = log "Done"
12 |
--------------------------------------------------------------------------------
/tests/purs/passing/3481.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Effect.Console (log)
4 |
5 | message = { "0": { "1": "Done" }}
6 |
7 | main = log message."0"."1"
8 |
--------------------------------------------------------------------------------
/tests/purs/passing/3549.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 |
5 | import Effect.Console (log)
6 |
7 | identity :: forall (a :: Type) . a -> a
8 | identity x = x
9 |
10 | map' :: forall (f :: Type -> Type) (a :: Type) (b :: Type) . Functor f => (a -> b) -> f a -> f b
11 | map' = map
12 |
13 | main = log "Done"
14 |
--------------------------------------------------------------------------------
/tests/purs/passing/3595.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude as P
4 | import Effect (Effect)
5 | import Effect.Console (log)
6 |
7 | class P.Show a <= Show a where
8 | id :: a -> a
9 |
10 | instance showString :: Show String where
11 | id x = x
12 |
13 | main :: Effect P.Unit
14 | main = log (id "Done")
15 |
--------------------------------------------------------------------------------
/tests/purs/passing/652.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect.Console (log)
5 |
6 | class Foo a b
7 |
8 | class Bar a c
9 |
10 | class (Foo a b, Bar a c) <= Baz a b c
11 |
12 | instance foo :: Foo (a -> b) a
13 |
14 | instance bar :: Bar (a -> b) b
15 |
16 | instance baz :: (Eq a) => Baz (a -> b) a b
17 |
18 | main = log "Done"
19 |
--------------------------------------------------------------------------------
/tests/purs/passing/810.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect.Console (log)
5 |
6 | data Maybe a = Nothing | Just a
7 |
8 | test :: forall a. Maybe a -> Maybe a
9 | test m = o.x
10 | where
11 | o = case m of Nothing -> { x : Nothing }
12 | Just a -> { x : Just a }
13 |
14 | main = log "Done"
15 |
--------------------------------------------------------------------------------
/tests/purs/passing/862.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect.Console
5 |
6 | id' = (\x -> x) <$> \y -> y
7 |
8 | main = log (id' "Done")
9 |
--------------------------------------------------------------------------------
/tests/purs/passing/922.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 |
5 | import Effect.Console
6 |
7 | class Default a where
8 | def :: a
9 |
10 | instance defaultString :: Default String where
11 | def = "Done"
12 |
13 | data I a = I a
14 |
15 | instance defaultI :: (Default a) => Default (I a) where
16 | def = I def
17 |
18 | main = do
19 | case def of
20 | I s -> log s
21 |
--------------------------------------------------------------------------------
/tests/purs/passing/Applicative.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Effect.Console (log)
4 |
5 | class Applicative f where
6 | pure :: forall a. a -> f a
7 | apply :: forall a b. f (a -> b) -> f a -> f b
8 |
9 | data Maybe a = Nothing | Just a
10 |
11 | instance applicativeMaybe :: Applicative Maybe where
12 | pure = Just
13 | apply (Just f) (Just a) = Just (f a)
14 | apply _ _ = Nothing
15 |
16 | main = log "Done"
17 |
--------------------------------------------------------------------------------
/tests/purs/passing/ArrayType.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect.Console (log)
5 |
6 | class Pointed p where
7 | point :: forall a. a -> p a
8 |
9 | instance pointedArray :: Pointed Array where
10 | point a = [a]
11 |
12 | main = log "Done"
13 |
--------------------------------------------------------------------------------
/tests/purs/passing/AutoPrelude.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect.Console (log)
5 |
6 | f x = x * 10.0
7 | g y = y - 10.0
8 |
9 | main = do
10 | log $ show $ (f <<< g) 100.0
11 | log "Done"
12 |
--------------------------------------------------------------------------------
/tests/purs/passing/AutoPrelude2.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Prelude as P
5 | import Effect.Console
6 |
7 | f :: forall a. a -> a
8 | f = P.identity
9 |
10 | main = P.($) log ((f P.<<< f) "Done")
11 |
--------------------------------------------------------------------------------
/tests/purs/passing/BindingGroups.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect.Console (log)
5 |
6 | foo = bar
7 | where bar r = r + 1.0
8 |
9 | r = foo 2.0
10 |
11 | main = log "Done"
12 |
--------------------------------------------------------------------------------
/tests/purs/passing/BlockString.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect.Console (log)
5 |
6 | foo :: String
7 | foo = """foo"""
8 |
9 | main = log "Done"
10 |
--------------------------------------------------------------------------------
/tests/purs/passing/CaseInputWildcard.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect (Effect)
5 | import Effect.Console (log)
6 |
7 | data Foo = X | Y
8 |
9 | what ∷ Foo → Int → Boolean → Foo
10 | what x = case _, x, _ of
11 | 0, X, true → X
12 | 0, Y, true → X
13 | _, _, _ → Y
14 |
15 | main :: Effect Unit
16 | main = do
17 | let tmp = what Y 0 true
18 | log "Done"
19 |
--------------------------------------------------------------------------------
/tests/purs/passing/CaseStatement.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect.Console (log)
5 |
6 | data A = A | B | C
7 |
8 | f a _ A = a
9 | f _ a B = a
10 | f _ _ C = "Done"
11 |
12 | g a _ A = a
13 | g _ b B = b
14 | g _ _ C = C
15 |
16 | data M a = N | J a
17 |
18 | h f N a = a
19 | h f a N = a
20 | h f (J a) (J b) = J (f a b)
21 |
22 | main = log $ f "Done" "Failed" A
23 |
--------------------------------------------------------------------------------
/tests/purs/passing/CheckFunction.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect.Console (log)
5 |
6 | test = ((\x -> x+1.0) >>> (\x -> x*2.0)) 4.0
7 |
8 | main = log "Done"
9 |
--------------------------------------------------------------------------------
/tests/purs/passing/CheckSynonymBug.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect.Console (log)
5 |
6 | length :: forall a. Array a -> Int
7 | length _ = 0
8 |
9 | type Foo a = Array a
10 |
11 | foo _ = length ([] :: Foo Number)
12 |
13 | main = log "Done"
14 |
--------------------------------------------------------------------------------
/tests/purs/passing/CheckTypeClass.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect.Console (log)
5 |
6 | data Bar a = Bar
7 | data Baz
8 |
9 | class Foo a where
10 | foo :: Bar a -> Baz
11 |
12 | foo_ :: forall a. Foo a => a -> Baz
13 | foo_ x = foo ((mkBar :: forall a. Foo a => a -> Bar a) x)
14 |
15 | mkBar :: forall a. a -> Bar a
16 | mkBar _ = Bar
17 |
18 | main = log "Done"
19 |
--------------------------------------------------------------------------------
/tests/purs/passing/ClassRefSyntax.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Lib (class X, go)
4 | import Effect.Console (log)
5 |
6 | go' :: forall a. X a => a -> a
7 | go' = go
8 |
9 | main = log "Done"
10 |
--------------------------------------------------------------------------------
/tests/purs/passing/ClassRefSyntax/Lib.purs:
--------------------------------------------------------------------------------
1 | module Lib (class X, go) where
2 |
3 | class X a where
4 | go :: a -> a
5 |
--------------------------------------------------------------------------------
/tests/purs/passing/Comparisons.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect
5 | import Effect.Console
6 | import Test.Assert
7 |
8 | main = do
9 | assert (1.0 < 2.0)
10 | assert (2.0 == 2.0)
11 | assert (3.0 > 1.0)
12 | assert ("a" < "b")
13 | assert ("a" == "a")
14 | assert ("z" > "a")
15 | log "Done"
16 |
--------------------------------------------------------------------------------
/tests/purs/passing/Conditional.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Effect.Console (log)
4 |
5 | fns = \f -> if f true then f else \x -> x
6 |
7 | not = \x -> if x then false else true
8 |
9 | main = log "Done"
10 |
--------------------------------------------------------------------------------
/tests/purs/passing/Console.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect
5 | import Effect.Console
6 |
7 | replicateM_ :: forall m a. Monad m => Number -> m a -> m Unit
8 | replicateM_ 0.0 _ = pure unit
9 | replicateM_ n act = do
10 | _ <- act
11 | replicateM_ (n - 1.0) act
12 |
13 | main = do
14 | replicateM_ 10.0 (log "Hello World!")
15 | log "Done"
16 |
--------------------------------------------------------------------------------
/tests/purs/passing/ConstraintInference.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect.Console (log)
5 |
6 | shout = log <<< (_ <> "!") <<< show
7 |
8 | main = do
9 | shout "Test"
10 | log "Done"
11 |
--------------------------------------------------------------------------------
/tests/purs/passing/ConstraintOutsideForall.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Effect.Console
4 |
5 | class Test a
6 |
7 | instance testUnit :: Test Int
8 |
9 | test :: Test Int => forall a. a -> a
10 | test a = a
11 |
12 | main = log (test "Done")
13 |
--------------------------------------------------------------------------------
/tests/purs/passing/ConstraintParens.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect.Console (log)
5 |
6 | class Foo a where
7 | foo ∷ a → a
8 |
9 | test ∷ ∀ a. (Foo a) ⇒ a → a
10 | test = foo
11 |
12 | main = log "Done"
13 |
--------------------------------------------------------------------------------
/tests/purs/passing/ConstraintParsingIssue.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Effect.Console
4 |
5 | class X a
6 |
7 | instance x :: X (Array (Array a)) => X (Array a)
8 |
9 | main = log "Done"
10 |
--------------------------------------------------------------------------------
/tests/purs/passing/ContextSimplification.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect.Console
5 |
6 | shout = log <<< (_ <> "!") <<< show
7 |
8 | -- Here, we should simplify the context so that only one Show
9 | -- constraint is added.
10 | usesShowTwice true = shout
11 | usesShowTwice false = logShow
12 |
13 | main = do
14 | usesShowTwice true "Test"
15 | log "Done"
16 |
--------------------------------------------------------------------------------
/tests/purs/passing/DataAndType.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect.Console (log)
5 |
6 | data A = A B
7 |
8 | type B = A
9 |
10 | main = log "Done"
11 |
--------------------------------------------------------------------------------
/tests/purs/passing/DataConsClassConsOverlapOk.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Effect.Console (log)
4 | import Prim.Row (class Cons)
5 |
6 | data Cons = Cons
7 |
8 | main = log "Done"
9 |
--------------------------------------------------------------------------------
/tests/purs/passing/DctorOperatorAlias/List.purs:
--------------------------------------------------------------------------------
1 | module List where
2 |
3 | data List a = Cons a (List a) | Nil
4 |
5 | infixr 6 Cons as :
6 |
--------------------------------------------------------------------------------
/tests/purs/passing/DeepCase.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect.Console (log, logShow)
5 |
6 | f x y =
7 | let
8 | g = case y of
9 | 0.0 -> x
10 | x -> 1.0 + x * x
11 | in g + x + y
12 |
13 | main = do
14 | logShow $ f 1.0 10.0
15 | log "Done"
16 |
--------------------------------------------------------------------------------
/tests/purs/passing/Dollar.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Effect.Console (log)
4 |
5 | applyFn :: forall a b. (a -> b) -> a -> b
6 | applyFn f x = f x
7 |
8 | infixr 1000 applyFn as $
9 |
10 | id x = x
11 |
12 | test1 x = id $ id $ id $ id $ x
13 |
14 | test2 x = id id $ id x
15 |
16 | main = log "Done"
17 |
--------------------------------------------------------------------------------
/tests/purs/passing/EffFn.js:
--------------------------------------------------------------------------------
1 | exports.add3 = function (a,b,c) { return a + b + c; };
--------------------------------------------------------------------------------
/tests/purs/passing/EmptyRow.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect.Console (log)
5 |
6 | data Foo r = Foo { | r }
7 |
8 | test :: Foo ()
9 | test = Foo {}
10 |
11 | main = log "Done"
12 |
--------------------------------------------------------------------------------
/tests/purs/passing/EmptyTypeClass.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect
5 | import Effect.Console
6 |
7 | head :: forall a. Partial => Array a -> a
8 | head [x] = x
9 |
10 | main :: Effect _
11 | main = log "Done"
12 |
--------------------------------------------------------------------------------
/tests/purs/passing/EntailsKindedType.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect
5 | import Effect.Console
6 |
7 | test x = show (x :: _ :: Type)
8 |
9 | main = do
10 | when (show (unit :: Unit :: Type) == "unit") (log "Done")
11 | when (test unit == "unit") (log "Done")
12 |
--------------------------------------------------------------------------------
/tests/purs/passing/Eq1Deriving.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Data.Eq (class Eq1)
5 | import Effect.Console (log)
6 |
7 | data Product a b = Product a b
8 |
9 | derive instance eqMu :: (Eq a, Eq b) => Eq (Product a b)
10 | derive instance eq1Mu :: Eq a => Eq1 (Product a)
11 |
12 | main = log "Done"
13 |
--------------------------------------------------------------------------------
/tests/purs/passing/Eq1InEqDeriving.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Data.Eq (class Eq1)
5 | import Effect.Console (log)
6 |
7 | newtype Mu f = In (f (Mu f))
8 |
9 | derive instance eqMu :: Eq1 f => Eq (Mu f)
10 |
11 | main = log "Done"
12 |
--------------------------------------------------------------------------------
/tests/purs/passing/ExplicitImportReExport.purs:
--------------------------------------------------------------------------------
1 | -- from #1244
2 | module Main where
3 |
4 | import Prelude
5 | import Effect.Console (log)
6 | import Bar (foo)
7 |
8 | baz :: Int
9 | baz = foo
10 |
11 | main = log "Done"
12 |
--------------------------------------------------------------------------------
/tests/purs/passing/ExplicitImportReExport/Bar.purs:
--------------------------------------------------------------------------------
1 | module Bar (module Foo) where
2 |
3 | import Foo
4 |
--------------------------------------------------------------------------------
/tests/purs/passing/ExplicitImportReExport/Foo.purs:
--------------------------------------------------------------------------------
1 | module Foo where
2 |
3 | foo :: Int
4 | foo = 3
5 |
--------------------------------------------------------------------------------
/tests/purs/passing/ExplicitOperatorSections.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect.Console (log)
5 |
6 | subtractOne :: Int -> Int
7 | subtractOne = (_ - 1)
8 |
9 | addOne :: Int -> Int
10 | addOne = (1 + _)
11 |
12 | named :: Int -> Int
13 | named = (_ `sub` 1)
14 |
15 | main = log "Done"
16 |
--------------------------------------------------------------------------------
/tests/purs/passing/ExportExplicit.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import M1
4 | import Effect.Console (log)
5 |
6 | testX = X
7 | testZ = Z
8 | testFoo = foo
9 |
10 | main = log "Done"
11 |
--------------------------------------------------------------------------------
/tests/purs/passing/ExportExplicit/M1.purs:
--------------------------------------------------------------------------------
1 | module M1 (X(X), Z(..), foo) where
2 |
3 | data X = X | Y
4 | data Z = Z
5 |
6 | foo :: Int
7 | foo = 0
8 |
9 | bar :: Int
10 | bar = 1
11 |
--------------------------------------------------------------------------------
/tests/purs/passing/ExportExplicit2.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import M1
4 | import Effect.Console (log)
5 |
6 | testBar = bar
7 |
8 | main = log "Done"
9 |
--------------------------------------------------------------------------------
/tests/purs/passing/ExportExplicit2/M1.purs:
--------------------------------------------------------------------------------
1 | module M1 (bar) where
2 |
3 | foo :: Int
4 | foo = 0
5 |
6 | bar :: Int
7 | bar = foo
8 |
--------------------------------------------------------------------------------
/tests/purs/passing/ExtendedInfixOperators.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect.Console (log, logShow)
5 | import Data.Function (on)
6 |
7 | comparing :: forall a b. Ord b => (a -> b) -> a -> a -> Ordering
8 | comparing f = compare `on` f
9 |
10 | null [] = true
11 | null _ = false
12 |
13 | test = [1.0, 2.0, 3.0] `comparing null` [4.0, 5.0, 6.0]
14 |
15 | main = do
16 | logShow test
17 | log "Done"
18 |
--------------------------------------------------------------------------------
/tests/purs/passing/FieldConsPuns.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect.Console (log, logShow)
5 |
6 | greet { greeting, name } = log $ greeting <> ", " <> name <> "."
7 |
8 | main = do
9 | greet { greeting, name }
10 | log "Done"
11 | where
12 | greeting = "Hello"
13 | name = "World"
14 |
--------------------------------------------------------------------------------
/tests/purs/passing/FieldPuns.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect.Console
5 |
6 | greet { greeting, name } = log $ greeting <> ", " <> name <> "."
7 |
8 | main = do
9 | greet { greeting: "Hello", name: "World" }
10 | log "Done"
11 |
--------------------------------------------------------------------------------
/tests/purs/passing/ForeignKind.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import ForeignKinds.Lib (kind Nat, Zero, Succ, N3, NatProxy, class AddNat, addNat, proxy1, proxy2)
5 | import Effect.Console (log)
6 |
7 | proxy1Add2Is3 :: NatProxy N3
8 | proxy1Add2Is3 = addNat proxy1 proxy2
9 |
10 | main = log "Done"
11 |
--------------------------------------------------------------------------------
/tests/purs/passing/FunctionScope.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Test.Assert
5 | import Effect.Console (log)
6 |
7 | mkValue :: Number -> Number
8 | mkValue id = id
9 |
10 | main = do
11 | let value = mkValue 1.0
12 | assert $ value == 1.0
13 | log "Done"
14 |
--------------------------------------------------------------------------------
/tests/purs/passing/Functions.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect.Console (log)
5 |
6 | test1 = \_ -> 0.0
7 |
8 | test2 = \a b -> a + b + 1.0
9 |
10 | test3 = \a -> a
11 |
12 | main = log "Done"
13 |
--------------------------------------------------------------------------------
/tests/purs/passing/Functions2.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Test.Assert
5 | import Effect.Console (log)
6 |
7 | test :: forall a b. a -> b -> a
8 | test = \const _ -> const
9 |
10 | main = do
11 | let value = test "Done" {}
12 | assert' "Not done" $ value == "Done"
13 | log "Done"
14 |
--------------------------------------------------------------------------------
/tests/purs/passing/Generalization1.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect.Console (logShow, log)
5 |
6 | main = do
7 | logShow (sum 1.0 2.0)
8 | logShow (sum 1 2)
9 | log "Done"
10 |
11 | sum x y = x + y
12 |
--------------------------------------------------------------------------------
/tests/purs/passing/HasOwnProperty.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Effect.Console (log)
4 |
5 | main = log ({hasOwnProperty: "Hi"} {hasOwnProperty = "Done"}).hasOwnProperty
6 |
--------------------------------------------------------------------------------
/tests/purs/passing/HoistError.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect
5 | import Effect.Console
6 | import Test.Assert
7 |
8 | main = do
9 | let x = 0.0
10 | assert $ x == 0.0
11 | let x = 1.0 + 1.0
12 | log "Done"
13 |
--------------------------------------------------------------------------------
/tests/purs/passing/IfThenElseMaybe.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect.Console (log)
5 |
6 | data Maybe a = Nothing | Just a
7 |
8 | test1 = if true then Just 10 else Nothing
9 |
10 | test2 = if true then Nothing else Just 10
11 |
12 | main = log "Done"
13 |
--------------------------------------------------------------------------------
/tests/purs/passing/IfWildcard.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect (Effect)
5 | import Effect.Console (log)
6 |
7 | data Foo = X | Y
8 |
9 | cond ∷ ∀ a. Boolean → a → a → a
10 | cond = if _ then _ else _
11 |
12 | what ∷ Boolean → Foo
13 | what = if _ then X else Y
14 |
15 | main :: Effect Unit
16 | main = do
17 | let tmp1 = what true
18 | tmp2 = cond true 0 1
19 | log "Done"
20 |
--------------------------------------------------------------------------------
/tests/purs/passing/ImplicitEmptyImport.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect.Console (log)
5 |
6 | main = do
7 | log "Hello"
8 | log "Goodbye"
9 | log "Done"
10 |
--------------------------------------------------------------------------------
/tests/purs/passing/Import.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import M2
4 | import Effect.Console (log)
5 |
6 | main = log "Done"
7 |
--------------------------------------------------------------------------------
/tests/purs/passing/Import/M1.purs:
--------------------------------------------------------------------------------
1 | module M1 where
2 |
3 | id :: forall a. a -> a
4 | id = \x -> x
5 |
6 | foo = id
7 |
--------------------------------------------------------------------------------
/tests/purs/passing/Import/M2.purs:
--------------------------------------------------------------------------------
1 | module M2 where
2 |
3 | import M1
4 |
5 | main = \_ -> foo 42
6 |
--------------------------------------------------------------------------------
/tests/purs/passing/ImportExplicit.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import M1 (X(..))
4 | import Effect.Console (log)
5 |
6 | testX :: X
7 | testX = X
8 | testY = Y
9 |
10 | main = log "Done"
11 |
--------------------------------------------------------------------------------
/tests/purs/passing/ImportExplicit/M1.purs:
--------------------------------------------------------------------------------
1 | module M1 where
2 |
3 | data X = X | Y
4 | data Z = Z
5 |
--------------------------------------------------------------------------------
/tests/purs/passing/ImportHiding.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Effect.Console
4 | import Prelude hiding (
5 | show, -- a value
6 | class Show, -- a type class
7 | Unit(..) -- a constructor
8 | )
9 |
10 | show = 1.0
11 |
12 | class Show a where
13 | noshow :: a -> a
14 |
15 | data Unit = X | Y
16 |
17 | main = do
18 | logShow show
19 | log "Done"
20 |
--------------------------------------------------------------------------------
/tests/purs/passing/ImportQualified.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect
5 | import M1
6 | import Effect.Console as C
7 |
8 | main = C.log (log "Done")
9 |
--------------------------------------------------------------------------------
/tests/purs/passing/ImportQualified/M1.purs:
--------------------------------------------------------------------------------
1 | module M1 where
2 |
3 | log x = x
4 |
--------------------------------------------------------------------------------
/tests/purs/passing/InferRecFunWithConstrainedArgument.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect.Console (log, logShow)
5 |
6 | test 100 = 100
7 | test n = test(1 + n)
8 |
9 | main = do
10 | logShow (test 0)
11 | log "Done"
12 |
--------------------------------------------------------------------------------
/tests/purs/passing/InstanceBeforeClass.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect.Console (log)
5 |
6 | instance fooNumber :: Foo Number where
7 | foo = 0.0
8 |
9 | class Foo a where
10 | foo :: a
11 |
12 | main = log "Done"
13 |
--------------------------------------------------------------------------------
/tests/purs/passing/InstanceSigs.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Effect.Console (log)
4 |
5 | class Foo a where
6 | foo :: a
7 |
8 | instance fooNumber :: Foo Number where
9 | foo :: Number
10 | foo = 0.0
11 |
12 | main = log "Done"
13 |
--------------------------------------------------------------------------------
/tests/purs/passing/InstanceSigsGeneral.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Effect.Console (log)
4 |
5 | class Eq a where
6 | eq :: a -> a -> Boolean
7 |
8 | instance eqNumber :: Eq Number where
9 | eq :: forall x y. x -> y -> Boolean
10 | eq _ _ = true
11 |
12 | main = log "Done"
13 |
--------------------------------------------------------------------------------
/tests/purs/passing/IntAndChar.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect
5 | import Effect.Console (log)
6 | import Test.Assert
7 |
8 | f 1 = 1
9 | f _ = 0
10 |
11 | g 'a' = 'a'
12 | g _ = 'b'
13 |
14 | main = do
15 | assert $ f 1 == 1
16 | assert $ f 0 == 0
17 | assert $ g 'a' == 'a'
18 | assert $ g 'b' == 'b'
19 | log "Done"
20 |
--------------------------------------------------------------------------------
/tests/purs/passing/JSReserved.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect.Console (log)
5 |
6 | yield = 0
7 | member = 1
8 |
9 | public = \return -> return
10 |
11 | this catch = catch
12 |
13 | main = log "Done"
14 |
--------------------------------------------------------------------------------
/tests/purs/passing/Let2.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect.Console (log, logShow)
5 |
6 | test =
7 | let f :: Number -> Boolean
8 | f 0.0 = false
9 | f n = g (n - 1.0)
10 |
11 | g :: Number -> Boolean
12 | g 0.0 = true
13 | g n = f (n - 1.0)
14 |
15 | x = f 1.0
16 | in not x
17 |
18 | main = do
19 | logShow test
20 | log "Done"
21 |
--------------------------------------------------------------------------------
/tests/purs/passing/LetInInstance.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect.Console (log)
5 |
6 | class Foo a where
7 | foo :: a -> String
8 |
9 | instance fooString :: Foo String where
10 | foo = go
11 | where
12 | go :: String -> String
13 | go s = s
14 |
15 | main = log "Done"
16 |
--------------------------------------------------------------------------------
/tests/purs/passing/Match.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect.Console (log)
5 |
6 | data Foo a = Foo
7 |
8 | foo = \f -> case f of Foo -> "foo"
9 |
10 | main = log "Done"
11 |
--------------------------------------------------------------------------------
/tests/purs/passing/Module.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import M1
4 | import M2
5 | import Effect.Console (log)
6 |
7 | main = log "Done"
8 |
--------------------------------------------------------------------------------
/tests/purs/passing/Module/M1.purs:
--------------------------------------------------------------------------------
1 | module M1 where
2 |
3 | import Prelude
4 |
5 | data Foo = Foo String
6 |
7 | foo :: Foo -> String
8 | foo = \f -> case f of Foo s -> s <> "foo"
9 |
10 | bar :: Foo -> String
11 | bar = foo
12 |
13 | incr :: Int -> Int
14 | incr x = x + 1
15 |
--------------------------------------------------------------------------------
/tests/purs/passing/Module/M2.purs:
--------------------------------------------------------------------------------
1 | module M2 where
2 |
3 | import Prelude
4 | import M1 as M1
5 |
6 | baz :: M1.Foo -> String
7 | baz = M1.foo
8 |
9 | match :: M1.Foo -> String
10 | match = \f -> case f of M1.Foo s -> s <> "foo"
11 |
--------------------------------------------------------------------------------
/tests/purs/passing/ModuleDeps.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import M1
4 | import Effect.Console (log)
5 |
6 | main = log "Done"
7 |
--------------------------------------------------------------------------------
/tests/purs/passing/ModuleDeps/M1.purs:
--------------------------------------------------------------------------------
1 | module M1 where
2 |
3 | import M2 as M2
4 |
5 | foo = M2.bar
6 |
--------------------------------------------------------------------------------
/tests/purs/passing/ModuleDeps/M2.purs:
--------------------------------------------------------------------------------
1 | module M2 where
2 |
3 | import M3 as M3
4 |
5 | bar = M3.baz
6 |
--------------------------------------------------------------------------------
/tests/purs/passing/ModuleDeps/M3.purs:
--------------------------------------------------------------------------------
1 | module M3 where
2 |
3 | baz = 1
4 |
--------------------------------------------------------------------------------
/tests/purs/passing/ModuleExport.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Effect.Console (log, logShow)
4 | import A
5 |
6 | main = do
7 | logShow (show 1.0)
8 | log "Done"
9 |
--------------------------------------------------------------------------------
/tests/purs/passing/ModuleExport/A.purs:
--------------------------------------------------------------------------------
1 | module A (module Prelude) where
2 |
3 | import Prelude
4 |
--------------------------------------------------------------------------------
/tests/purs/passing/ModuleExportDupes.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Effect.Console
4 | import A
5 | import B
6 | import C
7 | import Prelude
8 |
9 | main = do
10 | logShow (show 1.0)
11 | log "Done"
12 |
--------------------------------------------------------------------------------
/tests/purs/passing/ModuleExportDupes/A.purs:
--------------------------------------------------------------------------------
1 | module A (module Prelude) where
2 |
3 | import Prelude
4 |
--------------------------------------------------------------------------------
/tests/purs/passing/ModuleExportDupes/B.purs:
--------------------------------------------------------------------------------
1 | module B (module Prelude) where
2 |
3 | import Prelude
4 |
--------------------------------------------------------------------------------
/tests/purs/passing/ModuleExportDupes/C.purs:
--------------------------------------------------------------------------------
1 | module C (module Prelude, module A) where
2 |
3 | import Prelude
4 | import A
5 |
--------------------------------------------------------------------------------
/tests/purs/passing/ModuleExportExcluded.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect.Console (log, logShow)
5 | import A (foo)
6 |
7 | otherwise = false
8 |
9 | main = do
10 | logShow "1.0"
11 | log "Done"
12 |
--------------------------------------------------------------------------------
/tests/purs/passing/ModuleExportExcluded/A.purs:
--------------------------------------------------------------------------------
1 | module A (module Prelude, foo) where
2 |
3 | import Prelude
4 |
5 | foo :: Number -> Number
6 | foo _ = 0.0
7 |
--------------------------------------------------------------------------------
/tests/purs/passing/ModuleExportQualified.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect.Console (log, logShow)
5 | import A as B
6 |
7 | main = do
8 | logShow (B.show 1.0)
9 | log "Done"
10 |
--------------------------------------------------------------------------------
/tests/purs/passing/ModuleExportQualified/A.purs:
--------------------------------------------------------------------------------
1 | module A (module Prelude) where
2 |
3 | import Prelude
4 |
--------------------------------------------------------------------------------
/tests/purs/passing/ModuleExportSelf.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Effect.Console
4 | import A
5 |
6 | bar :: Foo
7 | bar = true
8 |
9 | main = do
10 | logShow (show bar)
11 | log "Done"
12 |
--------------------------------------------------------------------------------
/tests/purs/passing/ModuleExportSelf/A.purs:
--------------------------------------------------------------------------------
1 | module A (module A, module Prelude) where
2 |
3 | import Prelude
4 |
5 | type Foo = Boolean
6 |
--------------------------------------------------------------------------------
/tests/purs/passing/MutRec.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect.Console (log)
5 |
6 | f 0.0 = 0.0
7 | f x = g x + 0.0
8 |
9 | g x = f (x / 0.0)
10 |
11 | data Even = Zero | Even Odd
12 |
13 | data Odd = Odd Even
14 |
15 | evenToNumber Zero = 0.0
16 | evenToNumber (Even n) = oddToNumber n + 0.0
17 |
18 | oddToNumber (Odd n) = evenToNumber n + 0.0
19 |
20 | main = log "Done"
21 |
--------------------------------------------------------------------------------
/tests/purs/passing/MutRec2.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect.Console (log)
5 |
6 | data A = A B
7 |
8 | data B = B A
9 |
10 | foreign import data S :: Type
11 |
12 | f :: A -> S
13 | f a = case a of A b -> g b
14 |
15 | g b = case b of B a -> f a
16 |
17 | showN :: A -> S
18 | showN a = f a
19 |
20 | main = log "Done"
21 |
--------------------------------------------------------------------------------
/tests/purs/passing/MutRec3.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect.Console (log)
5 |
6 | data A = A B
7 |
8 | data B = B A
9 |
10 | foreign import data S :: Type
11 |
12 | f a = case a of A b -> g b
13 |
14 | g :: B -> S
15 | g b = case b of B a -> f a
16 |
17 | showN :: A -> S
18 | showN a = f a
19 |
20 | main = log "Done"
21 |
--------------------------------------------------------------------------------
/tests/purs/passing/NakedConstraint.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Effect.Console
4 |
5 | data List a = Nil | Cons a (List a)
6 |
7 | head :: Partial => List Int -> Int
8 | head (Cons x _) = x
9 |
10 | main = log "Done"
11 |
--------------------------------------------------------------------------------
/tests/purs/passing/NamedPatterns.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect.Console (log)
5 |
6 | foo = \x -> case x of
7 | y@{ foo: "Foo" } -> y
8 | y -> y
9 |
10 | main = log "Done"
11 |
--------------------------------------------------------------------------------
/tests/purs/passing/NegativeBinder.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect.Console (log)
5 |
6 | test :: Number -> Boolean
7 | test -1.0 = false
8 | test _ = true
9 |
10 | main = log "Done"
11 |
--------------------------------------------------------------------------------
/tests/purs/passing/NegativeIntInRange.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect.Console (log)
5 |
6 | n :: Int
7 | n = -2147483648
8 |
9 | main = log "Done"
10 |
--------------------------------------------------------------------------------
/tests/purs/passing/Nested.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect.Console (log)
5 |
6 | data Extend r a = Extend { prev :: r a, next :: a }
7 |
8 | data Matrix r a = Square (r (r a)) | Bigger (Matrix (Extend r) a)
9 |
10 | main = log "Done"
11 |
--------------------------------------------------------------------------------
/tests/purs/passing/NestedTypeSynonyms.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect.Console (log)
5 |
6 | type X = String
7 | type Y = X -> X
8 |
9 | fn :: Y
10 | fn a = a
11 |
12 | main = log (fn "Done")
13 |
--------------------------------------------------------------------------------
/tests/purs/passing/NestedWhere.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect.Console (log)
5 |
6 | f x = g x
7 | where
8 | g x = go x
9 | where
10 | go x = go1 (x - 1.0)
11 | go1 x = go x
12 |
13 | main = log "Done"
14 |
--------------------------------------------------------------------------------
/tests/purs/passing/NewConsClass.purs:
--------------------------------------------------------------------------------
1 | -- This test verifies that we can write a new type class `Cons` without errors
2 | -- in the presence of the `Cons` class from `Prim.Row`.
3 | module Main where
4 |
5 | import Effect.Console (log)
6 | import Prim.Row(class Union)
7 |
8 | class Cons x xs | xs -> x where
9 | cons :: x -> xs -> xs
10 |
11 |
12 | main = log "Done"
13 |
--------------------------------------------------------------------------------
/tests/purs/passing/NonConflictingExports.purs:
--------------------------------------------------------------------------------
1 | -- No failure here as the export `thing` only refers to Main.thing
2 | module Main (thing, main) where
3 |
4 | import A
5 | import Effect.Console (log)
6 |
7 | thing :: Int
8 | thing = 2
9 |
10 | main = log "Done"
11 |
--------------------------------------------------------------------------------
/tests/purs/passing/NonConflictingExports/A.purs:
--------------------------------------------------------------------------------
1 | module A where
2 |
3 | thing :: Int
4 | thing = 1
5 |
--------------------------------------------------------------------------------
/tests/purs/passing/NonOrphanInstanceFunDepExtra.purs:
--------------------------------------------------------------------------------
1 | -- Both f and l must be known, thus can be in separate modules
2 | module Main where
3 | import Effect.Console (log)
4 | import Lib
5 | data F
6 | data R
7 | instance cflr :: C F L R
8 | main = log "Done"
9 |
--------------------------------------------------------------------------------
/tests/purs/passing/NonOrphanInstanceFunDepExtra/Lib.purs:
--------------------------------------------------------------------------------
1 | module Lib where
2 | -- covering sets: {{f, l}}
3 | class C f l r | l -> r
4 | data L
5 |
--------------------------------------------------------------------------------
/tests/purs/passing/NonOrphanInstanceMulti.purs:
--------------------------------------------------------------------------------
1 | -- Both l and r must be known, thus can be in separate modules
2 | module Main where
3 | import Effect.Console (log)
4 | import Lib
5 | data L
6 | instance clr :: C L R
7 | main = log "Done"
8 |
--------------------------------------------------------------------------------
/tests/purs/passing/NonOrphanInstanceMulti/Lib.purs:
--------------------------------------------------------------------------------
1 | module Lib where
2 | -- covering sets: {{l, r}}
3 | class C l r
4 | data R
5 |
--------------------------------------------------------------------------------
/tests/purs/passing/ObjectGetter.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect.Console (log, logShow)
5 |
6 | getX = _.x
7 |
8 | point = { x: 1.0, y: 0.0 }
9 |
10 | main = do
11 | logShow $ getX point
12 | log $ _." 123 string Prop Name " { " 123 string Prop Name ": "OK" }
13 | log $ (_.x >>> _.y) { x: { y: "Nested" } }
14 | log $ _.value { value: "Done" }
15 |
--------------------------------------------------------------------------------
/tests/purs/passing/ObjectSynonym.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect.Console (log)
5 |
6 | type Inner = Number
7 |
8 | inner :: Inner
9 | inner = 0.0
10 |
11 | type Outer = { inner :: Inner }
12 |
13 | outer :: Outer
14 | outer = { inner: inner }
15 |
16 | main = log "Done"
17 |
--------------------------------------------------------------------------------
/tests/purs/passing/ObjectUpdate2.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect.Console (log)
5 |
6 | type X r = { | r }
7 |
8 | x :: X (baz :: String)
9 | x = { baz: "baz" }
10 |
11 | blah :: forall r. X r -> X r
12 | blah x = x
13 |
14 | test = blah x
15 | { baz = "blah"
16 | }
17 |
18 | main = log "Done"
19 |
--------------------------------------------------------------------------------
/tests/purs/passing/OneConstructor.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect.Console (log)
5 |
6 | data One a = One a
7 |
8 | one' (One a) = a
9 |
10 | main = log "Done"
11 |
--------------------------------------------------------------------------------
/tests/purs/passing/OperatorAlias.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect.Console
5 |
6 | infixl 4 what as ?!
7 |
8 | what :: forall a b. a -> b -> a
9 | what a _ = a
10 |
11 | main = log $ "Done" ?! true
12 |
--------------------------------------------------------------------------------
/tests/purs/passing/OperatorAliasElsewhere.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Def (what)
5 | import Effect.Console
6 |
7 | infixl 4 what as ?!
8 |
9 | main = log $ "Done" ?! true
10 |
--------------------------------------------------------------------------------
/tests/purs/passing/OperatorAliasElsewhere/Def.purs:
--------------------------------------------------------------------------------
1 | module Def where
2 |
3 | what :: forall a b. a -> b -> a
4 | what a _ = a
5 |
--------------------------------------------------------------------------------
/tests/purs/passing/Operators/Other.purs:
--------------------------------------------------------------------------------
1 | module Other where
2 |
3 | foo :: String -> String
4 | foo s = s
5 |
6 | baz :: String -> String -> String
7 | baz s _ = s
8 |
--------------------------------------------------------------------------------
/tests/purs/passing/OptimizerBug.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect.Console (log)
5 |
6 | x a = 1.0 + y a
7 |
8 | y a = x a
9 |
10 | main = log "Done"
11 |
--------------------------------------------------------------------------------
/tests/purs/passing/OptionalQualified.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude as P
4 |
5 | -- qualified import without the "qualified" keyword
6 | import Effect.Console as Console
7 |
8 | bind = P.bind
9 |
10 | main = do
11 | message <- P.pure "Done"
12 | Console.log message
13 |
--------------------------------------------------------------------------------
/tests/purs/passing/Ord1InOrdDeriving.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Data.Eq (class Eq1)
5 | import Data.Ord (class Ord1)
6 | import Effect.Console (log)
7 |
8 | newtype Mu f = In (f (Mu f))
9 |
10 | derive instance eqMu :: Eq1 f => Eq (Mu f)
11 | derive instance ordMu :: Ord1 f => Ord (Mu f)
12 |
13 | main = log "Done"
14 |
--------------------------------------------------------------------------------
/tests/purs/passing/ParensInType.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect (Effect)
5 | import Effect.Console (log)
6 |
7 | class Foo a where
8 | foo :: (String -> a ((Unit)))
9 |
10 | instance fooLogEff :: Foo Effect where
11 | foo = log
12 |
13 | main :: Effect Unit
14 | main = foo "Done"
15 |
--------------------------------------------------------------------------------
/tests/purs/passing/ParensInTypedBinder.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect (Effect)
5 | import Effect.Console (log)
6 |
7 | foo :: Array Int
8 | foo = do
9 | xss :: Array (Array Int) <- [[[1,2,3], [4, 5]], [[6]]]
10 | xs :: Array Int <- xss
11 | xs
12 |
13 | main :: Effect Unit
14 | main = log "Done"
15 |
--------------------------------------------------------------------------------
/tests/purs/passing/PartialFunction.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect
5 | import Effect.Console
6 |
7 | fn :: Partial => Number -> Number
8 | fn 0.0 = 0.0
9 | fn 1.0 = 2.0
10 |
11 | main = log "Done"
12 |
--------------------------------------------------------------------------------
/tests/purs/passing/PartialTCO.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect.Console (log)
5 | import Partial.Unsafe (unsafePartial)
6 |
7 | main = do
8 | let _ = unsafePartial partialTCO true 1000000
9 | log "Done"
10 |
11 | partialTCO :: Partial => Boolean -> Int -> Int
12 | partialTCO true 0 = 0
13 | partialTCO true n = partialTCO true (n - 1)
14 |
--------------------------------------------------------------------------------
/tests/purs/passing/PendingConflictingImports.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | -- No error as we never force `thing` to be resolved in `Main`
4 | import A
5 | import B
6 | import Effect.Console (log)
7 |
8 | main = log "Done"
9 |
--------------------------------------------------------------------------------
/tests/purs/passing/PendingConflictingImports/A.purs:
--------------------------------------------------------------------------------
1 | module A where
2 |
3 | thing :: Int
4 | thing = 1
5 |
--------------------------------------------------------------------------------
/tests/purs/passing/PendingConflictingImports/B.purs:
--------------------------------------------------------------------------------
1 | module B where
2 |
3 | thing :: Int
4 | thing = 2
5 |
--------------------------------------------------------------------------------
/tests/purs/passing/PendingConflictingImports2.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import A
4 | import Effect.Console (log)
5 |
6 | -- No error as we never force `thing` to be resolved in `Main`
7 | thing :: Int
8 | thing = 2
9 |
10 | main = log "Done"
11 |
--------------------------------------------------------------------------------
/tests/purs/passing/PendingConflictingImports2/A.purs:
--------------------------------------------------------------------------------
1 | module A where
2 |
3 | thing :: Int
4 | thing = 1
5 |
--------------------------------------------------------------------------------
/tests/purs/passing/Person.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect.Console (log)
5 |
6 | data Person = Person { name :: String, age :: Number }
7 |
8 | showPerson :: Person -> String
9 | showPerson = \p -> case p of
10 | Person o -> o.name <> ", aged " <> show o.age
11 |
12 | main = log "Done"
13 |
--------------------------------------------------------------------------------
/tests/purs/passing/PolyLabels.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | exports.unsafeGet = function (s) {
4 | return function (o) {
5 | return o[s];
6 | };
7 | };
8 |
9 | exports.unsafeSet = function(s) {
10 | return function(a) {
11 | return function (o) {
12 | var o1 = {};
13 | o1[s] = a;
14 | return Object.assign({}, o, o1);
15 | };
16 | };
17 | };
18 |
--------------------------------------------------------------------------------
/tests/purs/passing/PrimedTypeName.purs:
--------------------------------------------------------------------------------
1 | module Main (T, T', T'', T''', main) where
2 |
3 | import Prelude
4 | import Effect.Console (log)
5 |
6 | data T a = T
7 | type T' = T Unit
8 |
9 | data T'' = TP
10 |
11 | foreign import data T''' ∷ Type
12 |
13 | instance eqT ∷ Eq T'' where
14 | eq _ _ = true
15 |
16 | type A' a b = b → a
17 |
18 | infixr 4 type A' as ↫
19 |
20 | main = log "Done"
21 |
--------------------------------------------------------------------------------
/tests/purs/passing/QualifiedAdo/IxApplicative.purs:
--------------------------------------------------------------------------------
1 | module IxApplicative where
2 |
3 | class IxFunctor f where
4 | map ∷ forall a b x y. (a -> b) -> f x y a -> f x y b
5 |
6 | class IxFunctor f <= IxApplicative f where
7 | pure ∷ forall a x y. a -> f x y a
8 | apply ∷ forall a b x y z. f x y (a -> b) -> f y z a -> f x z b
9 |
--------------------------------------------------------------------------------
/tests/purs/passing/QualifiedDo/IxMonad.purs:
--------------------------------------------------------------------------------
1 | module IxMonad where
2 |
3 | class IxMonad m where
4 | pure ∷ forall a x y. a -> m x y a
5 | bind ∷ forall a b x y z. m x y a -> (a -> m y z b) -> m x z b
6 |
--------------------------------------------------------------------------------
/tests/purs/passing/QualifiedNames.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Either as Either
5 | import Effect.Console (log)
6 |
7 | either :: forall a b c. (a -> c) -> (b -> c) -> Either.Either a b -> c
8 | either f _ (Either.Left x) = f x
9 | either _ g (Either.Right y) = g y
10 |
11 | main = log (either identity identity (Either.Left "Done"))
12 |
--------------------------------------------------------------------------------
/tests/purs/passing/QualifiedNames/Either.purs:
--------------------------------------------------------------------------------
1 | module Either where
2 |
3 | import Prelude
4 |
5 | data Either a b = Left a | Right b
6 |
--------------------------------------------------------------------------------
/tests/purs/passing/QualifiedQualifiedImports.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | -- qualified import with qualified imported names
4 | import Effect.Console (log) as Console
5 |
6 | main = Console.log "Done"
7 |
--------------------------------------------------------------------------------
/tests/purs/passing/Rank2Object.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect.Console
5 |
6 | data Foo = Foo { id :: forall a. a -> a }
7 |
8 | foo :: Foo -> Number
9 | foo (Foo { id: f }) = f 0.0
10 |
11 | main = log "Done"
12 |
--------------------------------------------------------------------------------
/tests/purs/passing/Rank2TypeSynonym.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect.Console (log, logShow)
5 |
6 | type Foo a = forall f. Monad f => f a
7 |
8 | foo :: forall a. a -> Foo a
9 | foo x = pure x
10 |
11 | bar :: Foo Number
12 | bar = foo 3.0
13 |
14 | main = do
15 | x <- bar
16 | logShow x
17 | log "Done"
18 |
--------------------------------------------------------------------------------
/tests/purs/passing/Rank2Types.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect.Console (log)
5 |
6 | test1 :: (forall a. (a -> a)) -> Number
7 | test1 = \f -> f 0.0
8 |
9 | forever :: forall m a b. (forall a b. m a -> (a -> m b) -> m b) -> m a -> m b
10 | forever = \bind action -> bind action $ \_ -> forever bind action
11 |
12 | main = log "Done"
13 |
--------------------------------------------------------------------------------
/tests/purs/passing/ReExportQualified.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import C
5 | import Effect.Console (log)
6 |
7 | main = log (x <> y)
8 |
--------------------------------------------------------------------------------
/tests/purs/passing/ReExportQualified/A.purs:
--------------------------------------------------------------------------------
1 | module A where
2 |
3 | x = "Do"
4 |
--------------------------------------------------------------------------------
/tests/purs/passing/ReExportQualified/B.purs:
--------------------------------------------------------------------------------
1 | module B where
2 |
3 | y = "ne"
4 |
--------------------------------------------------------------------------------
/tests/purs/passing/ReExportQualified/C.purs:
--------------------------------------------------------------------------------
1 | module C (module A, module M2) where
2 |
3 | import A
4 | import B as M2
5 |
--------------------------------------------------------------------------------
/tests/purs/passing/Recursion.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect.Console (log)
5 |
6 | fib = \n -> case n of
7 | 0.0 -> 1.0
8 | 1.0 -> 1.0
9 | n -> fib (n - 1.0) + fib (n - 2.0)
10 |
11 | main = log "Done"
12 |
--------------------------------------------------------------------------------
/tests/purs/passing/RedefinedFixity.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import M3
4 | import Effect.Console (log)
5 |
6 | main = log "Done"
7 |
--------------------------------------------------------------------------------
/tests/purs/passing/RedefinedFixity/M1.purs:
--------------------------------------------------------------------------------
1 | module M1 where
2 |
3 | applyFn :: forall a b. (forall c d. c -> d) -> a -> b
4 | applyFn f a = f a
5 |
6 | infixr 1000 applyFn as $
7 |
--------------------------------------------------------------------------------
/tests/purs/passing/RedefinedFixity/M2.purs:
--------------------------------------------------------------------------------
1 | module M2 where
2 |
3 | import M1
4 |
--------------------------------------------------------------------------------
/tests/purs/passing/RedefinedFixity/M3.purs:
--------------------------------------------------------------------------------
1 | module M3 where
2 |
3 | import M1
4 | import M2
5 |
--------------------------------------------------------------------------------
/tests/purs/passing/ResolvableScopeConflict.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import A (thing)
4 | import B
5 | import Effect.Console (log)
6 |
7 | -- Not an error as although we have `thing` in scope from both A and B, it is
8 | -- imported explicitly from A, giving it a resolvable solution.
9 | what :: Boolean -> Int
10 | what true = thing
11 | what false = zing
12 |
13 | main = log "Done"
14 |
--------------------------------------------------------------------------------
/tests/purs/passing/ResolvableScopeConflict/A.purs:
--------------------------------------------------------------------------------
1 | module A where
2 |
3 | thing :: Int
4 | thing = 1
5 |
--------------------------------------------------------------------------------
/tests/purs/passing/ResolvableScopeConflict/B.purs:
--------------------------------------------------------------------------------
1 | module B where
2 |
3 | thing :: Int
4 | thing = 2
5 |
6 | zing :: Int
7 | zing = 3
8 |
--------------------------------------------------------------------------------
/tests/purs/passing/ResolvableScopeConflict2.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import A
4 | import Effect.Console (log)
5 |
6 | thing :: Int
7 | thing = 1
8 |
9 | -- Not an error as although we have `thing` in scope from both Main and A,
10 | -- as the local declaration takes precedence over the implicit import
11 | what :: Boolean -> Int
12 | what true = thing
13 | what false = zing
14 |
15 | main = log "Done"
16 |
--------------------------------------------------------------------------------
/tests/purs/passing/ResolvableScopeConflict2/A.purs:
--------------------------------------------------------------------------------
1 | module A where
2 |
3 | thing :: Int
4 | thing = 2
5 |
6 | zing :: Int
7 | zing = 3
8 |
--------------------------------------------------------------------------------
/tests/purs/passing/ResolvableScopeConflict3.purs:
--------------------------------------------------------------------------------
1 | module Main (thing, main, module A) where
2 |
3 | import A
4 | import Effect.Console (log)
5 |
6 | thing :: Int
7 | thing = 2
8 |
9 | main = log "Done"
10 |
--------------------------------------------------------------------------------
/tests/purs/passing/ResolvableScopeConflict3/A.purs:
--------------------------------------------------------------------------------
1 | module A where
2 |
3 | thing :: Int
4 | thing = 1
5 |
--------------------------------------------------------------------------------
/tests/purs/passing/RowUnion.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | exports.merge = function (dict) {
4 | return function (l) {
5 | return function (r) {
6 | var o = {};
7 | return Object.assign(o, r, l);
8 | };
9 | };
10 | };
11 |
--------------------------------------------------------------------------------
/tests/purs/passing/RunFnInline.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 |
5 | import Effect.Console (log)
6 |
7 | runFn3 :: forall a b c d. (a -> b -> c -> d) -> a -> b -> c -> d
8 | runFn3 f a b c = f a b c
9 |
10 | main = do
11 | log $ runFn3 (\a b c -> c) 1 2 "Done"
12 |
--------------------------------------------------------------------------------
/tests/purs/passing/ShadowedModuleName.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Test
4 | import Effect.Console
5 |
6 | data Test = Test
7 |
8 | main = log (runZ (Z "Done"))
9 |
--------------------------------------------------------------------------------
/tests/purs/passing/ShadowedModuleName/Test.purs:
--------------------------------------------------------------------------------
1 | module Test where
2 |
3 | data Z = Z String
4 |
5 | runZ :: Z -> String
6 | runZ (Z s) = s
7 |
--------------------------------------------------------------------------------
/tests/purs/passing/ShadowedName.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect.Console
5 | import Effect.Console (log)
6 |
7 | done :: String
8 | done = let str = "Not yet done" in
9 | let str = "Done" in str
10 |
11 | main = log done
12 |
--------------------------------------------------------------------------------
/tests/purs/passing/ShadowedRename.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect
5 | import Effect.Console
6 | import Test.Assert
7 |
8 | foo foo = let foo_1 = \_ -> foo
9 | foo_2 = foo_1 unit + 1.0
10 | in foo_2
11 |
12 | main = do
13 | assert $ foo 1.0 == 2.0
14 | log "Done"
15 |
--------------------------------------------------------------------------------
/tests/purs/passing/ShadowedTCOLet.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Partial.Unsafe (unsafePartial)
5 | import Effect
6 | import Effect.Console (log)
7 |
8 | f x y z =
9 | let f 1.0 2.0 3.0 = 1.0
10 | in f x z y
11 |
12 | main :: Effect _
13 | main = do
14 | log $ show $ unsafePartial f 1.0 3.0 2.0
15 | log "Done"
16 |
--------------------------------------------------------------------------------
/tests/purs/passing/SignedNumericLiterals.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect.Console (log)
5 |
6 | p = 0.5
7 | q = 1.0
8 | x = -1.0
9 | y = -0.5
10 | z = 0.5
11 | w = 1.0
12 |
13 | f :: Number -> Number
14 | f x = -x
15 |
16 | test1 = 2.0 - 1.0
17 |
18 | main = log "Done"
19 |
--------------------------------------------------------------------------------
/tests/purs/passing/SolvingIsSymbol/Lib.purs:
--------------------------------------------------------------------------------
1 | module SolvingIsSymbol.Lib where
2 |
3 | import Data.Symbol
4 |
5 | literalSymbol :: SProxy "literal"
6 | literalSymbol = SProxy
7 |
8 | libReflectSymbol :: forall s. IsSymbol s => SProxy s -> String
9 | libReflectSymbol = reflectSymbol
10 |
11 |
--------------------------------------------------------------------------------
/tests/purs/passing/StringEdgeCases.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Records as Records
5 | import Symbols as Symbols
6 |
7 | main = do
8 | Records.main
9 | Symbols.main
10 |
--------------------------------------------------------------------------------
/tests/purs/passing/TCOCase.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect.Console (log)
5 |
6 | data Data = One | More Data
7 |
8 | main = log (from (to 10000.0 One))
9 | where
10 | to 0.0 a = a
11 | to n a = to (n - 1.0) (More a)
12 | from One = "Done"
13 | from (More d) = from d
14 |
--------------------------------------------------------------------------------
/tests/purs/passing/Tick.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect.Console (log)
5 |
6 | test' x = x
7 |
8 | main = log "Done"
9 |
--------------------------------------------------------------------------------
/tests/purs/passing/TopLevelCase.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect.Console (log)
5 |
6 | gcd :: Number -> Number -> Number
7 | gcd 0.0 x = x
8 | gcd x 0.0 = x
9 | gcd x y | x > y = gcd (x `mod` y) y
10 | gcd x y = gcd (y `mod` x) x
11 |
12 | guardsTest [x] | x > 0.0 = []
13 | guardsTest xs = xs
14 |
15 | data A = A
16 |
17 | parseTest A 0.0 = 0.0
18 |
19 | main = log "Done"
20 |
--------------------------------------------------------------------------------
/tests/purs/passing/TransitiveImport.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Middle
5 | import Effect.Console
6 |
7 | main = do
8 | logShow (middle unit)
9 | log "Done"
10 |
--------------------------------------------------------------------------------
/tests/purs/passing/TransitiveImport/Middle.purs:
--------------------------------------------------------------------------------
1 | module Middle where
2 |
3 | import Test (test)
4 |
5 | middle = test
6 |
--------------------------------------------------------------------------------
/tests/purs/passing/TransitiveImport/Test.purs:
--------------------------------------------------------------------------------
1 | module Test where
2 |
3 | import Prelude
4 |
5 | class TestCls a where
6 | test :: a -> a
7 |
8 | instance unitTestCls :: TestCls Unit where
9 | test _ = unit
10 |
--------------------------------------------------------------------------------
/tests/purs/passing/TypeAnnotationPrecedence.purs:
--------------------------------------------------------------------------------
1 | -- See #3554
2 | module Main where
3 |
4 | import Prelude
5 | import Effect (Effect)
6 | import Effect.Console (log)
7 | import Data.Tuple (Tuple(..), uncurry)
8 |
9 | appendAndLog = log <<< uncurry append :: Tuple String String -> Effect Unit
10 |
11 | main = appendAndLog (Tuple "Do" "ne")
12 |
--------------------------------------------------------------------------------
/tests/purs/passing/TypeClassMemberOrderChange.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect.Console (log)
5 |
6 | class Test a where
7 | fn :: a -> a -> a
8 | val :: a
9 |
10 | instance testBoolean :: Test Boolean where
11 | val = true
12 | fn x y = y
13 |
14 | main = do
15 | log (show (fn true val))
16 | log "Done"
17 |
--------------------------------------------------------------------------------
/tests/purs/passing/TypeClassesInOrder.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect.Console (log)
5 |
6 | class Foo a where
7 | foo :: a -> String
8 |
9 | instance fooString :: Foo String where
10 | foo s = s
11 |
12 | main = log $ foo "Done"
13 |
--------------------------------------------------------------------------------
/tests/purs/passing/TypeClassesWithOverlappingTypeVariables.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect.Console (log)
5 |
6 | data Either a b = Left a | Right b
7 |
8 | instance functorEither :: Functor (Either a) where
9 | map _ (Left x) = Left x
10 | map f (Right y) = Right (f y)
11 |
12 | main = log "Done"
13 |
--------------------------------------------------------------------------------
/tests/purs/passing/TypeDecl.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect.Console (log)
5 |
6 | k :: String -> Number -> String
7 | k x y = x
8 |
9 | iterate :: forall a. Number -> (a -> a) -> a -> a
10 | iterate 0.0 f a = a
11 | iterate n f a = iterate (n - 1.0) f (f a)
12 |
13 | main = log "Done"
14 |
--------------------------------------------------------------------------------
/tests/purs/passing/TypeSynonymInData.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect.Console (log)
5 |
6 | type A a = Array a
7 |
8 | data Foo a = Foo (A a) | Bar
9 |
10 | foo (Foo []) = Bar
11 |
12 | main = log "Done"
13 |
--------------------------------------------------------------------------------
/tests/purs/passing/TypeWildcards.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect.Console (log)
5 |
6 | testTopLevel :: _ -> _
7 | testTopLevel n = n + 1.0
8 |
9 | test :: forall a. Eq a => (a -> a) -> a -> a
10 | test f a = go (f a) a
11 | where
12 | go :: _ -> _ -> _
13 | go a1 a2 | a1 == a2 = a1
14 | go a1 _ = go (f a1) a1
15 |
16 | main = log "Done"
17 |
--------------------------------------------------------------------------------
/tests/purs/passing/TypeWildcardsRecordExtension.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect.Console (log)
5 |
6 | foo :: forall a. {b :: Number | a} -> {b :: Number | _}
7 | foo f = f
8 |
9 | main = log "Done"
10 |
--------------------------------------------------------------------------------
/tests/purs/passing/TypeWithoutParens.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Lib (X, Y)
4 | import Effect.Console (log)
5 |
6 | idX :: X -> X
7 | idX x = x
8 |
9 | idY :: Y -> Y
10 | idY y = y
11 |
12 | main = log "Done"
13 |
--------------------------------------------------------------------------------
/tests/purs/passing/TypeWithoutParens/Lib.purs:
--------------------------------------------------------------------------------
1 | module Lib (X, Y) where
2 |
3 | data X = X
4 | type Y = X
5 |
--------------------------------------------------------------------------------
/tests/purs/passing/UTF8Sourcefile.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Effect.Console
4 |
5 | -- '→' is multibyte sequence \u2192.
6 | utf8multibyte = "Hello λ→ world!!"
7 |
8 | main = log "Done"
9 |
--------------------------------------------------------------------------------
/tests/purs/passing/UnderscoreIdent.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect.Console (log)
5 |
6 | data Data_type = Con_Structor | Con_2 String
7 |
8 | type Type_name = Data_type
9 |
10 | done (Con_2 s) = s
11 | done _ = "Failed"
12 |
13 | main = log (done (Con_2 "Done"))
14 |
--------------------------------------------------------------------------------
/tests/purs/passing/UnicodeIdentifier.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Effect.Console (log)
4 |
5 | f asgård = asgård
6 |
7 | main = log (f "Done")
8 |
--------------------------------------------------------------------------------
/tests/purs/passing/Unit.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect.Console (logShow, log)
5 |
6 | main = do
7 | logShow (const unit $ "Hello world")
8 | log "Done"
9 |
--------------------------------------------------------------------------------
/tests/purs/passing/UnknownInTypeClassLookup.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect.Console (log)
5 |
6 | class EQ a b
7 |
8 | instance eqAA :: EQ a a
9 |
10 | test :: forall a b. EQ a b => a -> b -> String
11 | test _ _ = "Done"
12 |
13 | runTest a = test a a
14 |
15 | main = log $ runTest 0.0
16 |
--------------------------------------------------------------------------------
/tests/purs/passing/UnsafeCoerce.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude (Unit)
4 | import Unsafe.Coerce (unsafeCoerce)
5 | import Effect (Effect)
6 | import Effect.Console (log)
7 |
8 | x :: Number
9 | x = unsafeCoerce 1
10 |
11 | y :: Number
12 | y = case unsafeCoerce 1 of
13 | z -> unsafeCoerce z
14 |
15 | main :: Effect Unit
16 | main = log "Done"
17 |
--------------------------------------------------------------------------------
/tests/purs/passing/WildcardType.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect.Console (log)
5 |
6 | f1 :: (_ -> _) -> _
7 | f1 g = g 1
8 |
9 | f2 :: _ -> _
10 | f2 _ = "Done"
11 |
12 | main = log $ f1 f2
13 |
--------------------------------------------------------------------------------
/tests/purs/passing/iota.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Effect.Console (log)
4 |
5 | s = \x -> \y -> \z -> x z (y z)
6 |
7 | k = \x -> \y -> x
8 |
9 | iota = \x -> x s k
10 |
11 | main = log "Done"
12 |
--------------------------------------------------------------------------------
/tests/purs/passing/s.purs:
--------------------------------------------------------------------------------
1 | module Main where
2 |
3 | import Prelude
4 | import Effect.Console (log)
5 |
6 | s = \x y z -> x z (y z)
7 |
8 | main = log "Done"
9 |
--------------------------------------------------------------------------------
/tests/purs/psci/BasicEval.purs:
--------------------------------------------------------------------------------
1 | import Prelude
2 | import Data.Array
3 |
4 | -- @shouldEvaluateTo 3628800
5 | let fac n = foldl mul 1 (1..n) in fac 10
6 |
7 | fac n = foldl mul 1 (1..n)
8 |
9 | -- @shouldEvaluateTo 3628800
10 | fac 10
11 |
--------------------------------------------------------------------------------
/tests/purs/psci/Multiline.purs:
--------------------------------------------------------------------------------
1 | -- @paste
2 | import Prelude
3 | import Data.Array
4 | -- @paste
5 |
6 | -- @paste
7 | fac :: Int -> Int
8 | fac n = foldl mul 1 (1..n)
9 | -- @paste
10 |
11 | -- @shouldEvaluateTo 3628800
12 | fac 10
13 |
--------------------------------------------------------------------------------
/tests/purs/publish/basic-example/README.md:
--------------------------------------------------------------------------------
1 | This directory contains a basic synthetic example project for testing `purs
2 | publish` with. Although it claims to depend upon `purescript-prelude`,
3 | `purescript-console`, and `purescript-effect`, we don't reproduce the real
4 | libraries here; instead, we just provide a couple of declarations for the
5 | purpose of testing.
6 |
--------------------------------------------------------------------------------
/tests/purs/publish/basic-example/bower.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "basic-example",
3 | "repository": {
4 | "type": "git",
5 | "url": "https://github.com/purescript/test.git"
6 | },
7 | "license": "MIT",
8 | "dependencies": {
9 | "purescript-console": "^1.0.0",
10 | "purescript-prelude": "^1.0.0",
11 | "purescript-effect": "^1.0.0"
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/tests/purs/warning/2140.purs:
--------------------------------------------------------------------------------
1 | -- @shouldWarnWith ShadowedTypeVar
2 | module Main where
3 |
4 | class Test a where
5 | f :: (forall a. a -> a) -> a -> a
6 |
--------------------------------------------------------------------------------
/tests/purs/warning/2383.purs:
--------------------------------------------------------------------------------
1 | -- | This specifically shouldn't warn about `x` being shadowed in `main`
2 | -- | See https://github.com/purescript/purescript/issues/2383
3 | module Main where
4 |
5 | import Prelude
6 |
7 | import Effect (Effect)
8 |
9 | main :: Effect Unit
10 | main = do
11 | x <- let x = pure unit in x
12 | pure unit
13 |
--------------------------------------------------------------------------------
/tests/purs/warning/2411.purs:
--------------------------------------------------------------------------------
1 | -- @shouldWarnWith ShadowedName
2 | module Main where
3 |
4 | import Prelude
5 |
6 | import Effect (Effect)
7 |
8 | test :: forall m. Monad m => Int -> m Unit
9 | test x =
10 | let x = unit
11 | in pure x
12 |
13 | main :: Effect Unit
14 | main = test 42
15 |
16 |
--------------------------------------------------------------------------------
/tests/purs/warning/CustomWarning.purs:
--------------------------------------------------------------------------------
1 | -- @shouldWarnWith UserDefinedWarning
2 | module Main where
3 |
4 | import Prim.TypeError
5 |
6 | foo :: forall t. Warn (Beside (Text "Custom warning ") (Quote t)) => t -> t
7 | foo x = x
8 |
9 | bar :: Int
10 | bar = foo 42
11 |
12 |
--------------------------------------------------------------------------------
/tests/purs/warning/CustomWarning2.purs:
--------------------------------------------------------------------------------
1 | -- @shouldWarnWith UserDefinedWarning
2 | module Main where
3 |
4 | import Prim.TypeError
5 |
6 | foo :: Warn (Text "foo") => Int -> Int
7 | foo x = x
8 |
9 | bar :: Warn (Text "foo") => Int
10 | bar = foo 42
11 |
12 | baz :: Int
13 | baz = bar
14 |
--------------------------------------------------------------------------------
/tests/purs/warning/CustomWarning3.purs:
--------------------------------------------------------------------------------
1 | -- @shouldWarnWith UserDefinedWarning
2 | -- @shouldWarnWith UserDefinedWarning
3 | module Main where
4 |
5 | import Prim.TypeError
6 |
7 | foo :: Warn (Text "foo") => Int -> Int
8 | foo x = x
9 |
10 | -- Defer the "foo" warning and warn with "bar" as well
11 | bar :: Warn (Text "foo") => Warn (Text "bar") => Int
12 | bar = foo 42
13 |
14 | baz :: Int
15 | baz = bar
16 |
--------------------------------------------------------------------------------
/tests/purs/warning/DuplicateImport.purs:
--------------------------------------------------------------------------------
1 | -- @shouldWarnWith DuplicateImport
2 | module Main where
3 |
4 | import Prelude (Unit, unit, pure)
5 | import Prelude (Unit, unit, pure)
6 |
7 | import Effect (Effect)
8 |
9 | main :: Effect Unit
10 | main = pure unit
11 |
--------------------------------------------------------------------------------
/tests/purs/warning/DuplicateSelectiveImport.purs:
--------------------------------------------------------------------------------
1 | -- @shouldWarnWith DuplicateSelectiveImport
2 | module Main where
3 |
4 | import Prelude (Unit, unit)
5 | import Prelude (pure)
6 |
7 | import Effect (Effect)
8 |
9 | main :: Effect Unit
10 | main = pure unit
11 |
--------------------------------------------------------------------------------
/tests/purs/warning/HidingImport.purs:
--------------------------------------------------------------------------------
1 | -- @shouldWarnWith HidingImport
2 | -- @shouldWarnWith HidingImport
3 | module Main where
4 |
5 | import Prelude hiding (one)
6 | import Effect hiding (untilE)
7 |
8 | main :: Effect Unit
9 | main = pure unit
10 |
--------------------------------------------------------------------------------
/tests/purs/warning/ImplicitImport.purs:
--------------------------------------------------------------------------------
1 | -- @shouldWarnWith ImplicitImport
2 | -- @shouldWarnWith ImplicitImport
3 | module Main where
4 |
5 | import Prelude
6 | import Effect
7 |
8 | main :: Effect Unit
9 | main = pure unit
10 |
--------------------------------------------------------------------------------
/tests/purs/warning/ImplicitQualifiedImport.purs:
--------------------------------------------------------------------------------
1 | -- @shouldWarnWith ImplicitQualifiedImport
2 | -- @shouldWarnWith ImplicitQualifiedImport
3 | module Main where
4 |
5 | import Data.Unit
6 |
7 | import Effect as E
8 | import Effect.Console as E
9 |
10 | main :: E.Effect Unit
11 | main = E.log "test"
12 |
--------------------------------------------------------------------------------
/tests/purs/warning/ImplicitQualifiedImportReExport.purs:
--------------------------------------------------------------------------------
1 | -- @shouldWarnWith ImplicitQualifiedImportReExport
2 | -- @shouldWarnWith ImplicitQualifiedImportReExport
3 | module Main (module X, module Y, main) where
4 |
5 | import Prelude
6 |
7 | import Effect (Effect)
8 | import Effect.Console (log)
9 | import Data.Maybe as X
10 | import Data.Either as Y
11 |
12 | main :: Effect Unit
13 | main = log "test"
14 |
--------------------------------------------------------------------------------
/tests/purs/warning/Kind-UnusedExplicitImport-1.purs:
--------------------------------------------------------------------------------
1 | -- @shouldWarnWith UnusedExplicitImport
2 | module Main where
3 |
4 | import Prelude (Unit, unit, pure)
5 | import Effect (Effect)
6 | import Type.RowList (RLProxy, kind RowList)
7 |
8 | class A (a :: RowList)
9 |
10 | main :: Effect Unit
11 | main = pure unit
12 |
--------------------------------------------------------------------------------
/tests/purs/warning/Kind-UnusedExplicitImport-2.purs:
--------------------------------------------------------------------------------
1 | -- @shouldWarnWith UnusedExplicitImport
2 | module Main where
3 |
4 | import Prelude (Unit, unit, pure)
5 | import Effect (Effect)
6 | import Type.RowList (RLProxy, kind RowList)
7 |
8 | f :: forall l. RLProxy l -> Int
9 | f _ = 0
10 |
11 | main :: Effect Unit
12 | main = pure unit
13 |
--------------------------------------------------------------------------------
/tests/purs/warning/Kind-UnusedImport.purs:
--------------------------------------------------------------------------------
1 | -- @shouldWarnWith UnusedImport
2 | module Main where
3 |
4 | import Prelude (Unit, unit, pure)
5 | import Effect (Effect)
6 | import Type.RowList (kind RowList)
7 |
8 | main :: Effect Unit
9 | main = pure unit
10 |
--------------------------------------------------------------------------------
/tests/purs/warning/KindReExport.purs:
--------------------------------------------------------------------------------
1 | -- | This test is to ensure that we do not get an incorrect 'unused kind'
2 | -- | warning. See #3744
3 | module Main (main, module X) where
4 |
5 | import Prelude
6 | import Effect (Effect)
7 | import Effect.Console (log)
8 | import Prim.Ordering (kind Ordering) as X
9 |
10 | main :: Effect Unit
11 | main = log "Done"
12 |
--------------------------------------------------------------------------------
/tests/purs/warning/MissingTypeDeclaration.purs:
--------------------------------------------------------------------------------
1 | -- @shouldWarnWith MissingTypeDeclaration
2 | module Main where
3 |
4 | x = 0
5 |
--------------------------------------------------------------------------------
/tests/purs/warning/NewtypeInstance.purs:
--------------------------------------------------------------------------------
1 | -- @shouldWarnWith MissingNewtypeSuperclassInstance
2 | module Main where
3 |
4 | import Prelude
5 |
6 | newtype X = X String
7 |
8 | derive newtype instance ordX :: Ord X
9 |
--------------------------------------------------------------------------------
/tests/purs/warning/OverlappingPattern.purs:
--------------------------------------------------------------------------------
1 | -- @shouldWarnWith OverlappingPattern
2 | -- @shouldWarnWith OverlappingPattern
3 | module Main where
4 |
5 | data X = A | B
6 |
7 | pat1 :: X -> Boolean
8 | pat1 A = true
9 | pat1 A = true
10 | pat1 B = false
11 |
12 | pat2 :: X -> Boolean
13 | pat2 A = true
14 | pat2 _ = false
15 | pat2 B = false
16 |
--------------------------------------------------------------------------------
/tests/purs/warning/ScopeShadowing2.purs:
--------------------------------------------------------------------------------
1 | -- @shouldWarnWith ScopeShadowing
2 | module Main
3 | ( append
4 | , module Data.Semigroup
5 | ) where
6 |
7 | import Data.Semigroup
8 |
9 | append :: forall a. a -> a -> a
10 | append x _ = x
11 |
--------------------------------------------------------------------------------
/tests/purs/warning/ShadowedBinderPatternGuard.purs:
--------------------------------------------------------------------------------
1 | -- @shouldWarnWith ShadowedName
2 | module Main where
3 |
4 | f :: Int -> Int
5 | f n | i <- true -- this i is shadowed
6 | , i <- 1234
7 | = i
8 |
--------------------------------------------------------------------------------
/tests/purs/warning/ShadowedNameParens.purs:
--------------------------------------------------------------------------------
1 | -- @shouldWarnWith ShadowedName
2 | module Main where
3 |
4 | f :: Int -> Int -> Int
5 | f n = \(n) -> 1
6 |
--------------------------------------------------------------------------------
/tests/purs/warning/ShadowedTypeVar.purs:
--------------------------------------------------------------------------------
1 | -- @shouldWarnWith ShadowedTypeVar
2 | module Main where
3 |
4 | f :: forall a. (forall a. a -> a) -> a -> a
5 | f g x = g x
6 |
--------------------------------------------------------------------------------
/tests/purs/warning/UnnecessaryFFIModule.js:
--------------------------------------------------------------------------------
1 | exports.out = null;
2 |
--------------------------------------------------------------------------------
/tests/purs/warning/UnnecessaryFFIModule.purs:
--------------------------------------------------------------------------------
1 | -- @shouldWarnWith UnnecessaryFFIModule
2 | module Main where
3 |
4 | t :: Boolean
5 | t = true
6 |
--------------------------------------------------------------------------------
/tests/purs/warning/UnusedDctorExplicitImport.purs:
--------------------------------------------------------------------------------
1 | -- @shouldWarnWith UnusedDctorExplicitImport
2 | module Main where
3 |
4 | import Data.Ordering (Ordering(EQ, LT))
5 |
6 | f :: Ordering -> Ordering
7 | f EQ = EQ
8 | f x = x
9 |
--------------------------------------------------------------------------------
/tests/purs/warning/UnusedDctorImportAll.purs:
--------------------------------------------------------------------------------
1 | -- @shouldWarnWith UnusedDctorImport
2 | module Main where
3 |
4 | import Data.Ordering (Ordering(..))
5 |
6 | f :: Ordering -> Ordering
7 | f x = x
8 |
--------------------------------------------------------------------------------
/tests/purs/warning/UnusedDctorImportExplicit.purs:
--------------------------------------------------------------------------------
1 | -- @shouldWarnWith UnusedDctorImport
2 | module Main where
3 |
4 | import Data.Ordering (Ordering(EQ))
5 |
6 | f :: Ordering -> Ordering
7 | f x = x
8 |
--------------------------------------------------------------------------------
/tests/purs/warning/UnusedExplicitImport.purs:
--------------------------------------------------------------------------------
1 | -- @shouldWarnWith UnusedExplicitImport
2 | module Main where
3 |
4 | import Prelude (Unit, unit, pure, bind)
5 | import Effect (Effect)
6 |
7 | main :: Effect Unit
8 | main = pure unit
9 |
--------------------------------------------------------------------------------
/tests/purs/warning/UnusedExplicitImportTypeOp.purs:
--------------------------------------------------------------------------------
1 | -- @shouldWarnWith UnusedExplicitImport
2 | module Main where
3 |
4 | import Prelude (Unit, unit, pure)
5 | import Effect (Effect)
6 | import Lib (type (~>), natId)
7 |
8 | main :: Effect Unit
9 | main = natId (pure unit)
10 |
--------------------------------------------------------------------------------
/tests/purs/warning/UnusedExplicitImportTypeOp/Lib.purs:
--------------------------------------------------------------------------------
1 | module Lib where
2 |
3 | type Nat f g = ∀ x. f x → g x
4 |
5 | infixr 4 type Nat as ~>
6 |
7 | natId ∷ ∀ f. f ~> f
8 | natId x = x
9 |
--------------------------------------------------------------------------------
/tests/purs/warning/UnusedExplicitImportValOp.purs:
--------------------------------------------------------------------------------
1 | -- @shouldWarnWith UnusedExplicitImport
2 | module Main where
3 |
4 | import Prelude (Unit, unit, pure, (+))
5 | import Effect (Effect)
6 |
7 | main :: Effect Unit
8 | main = pure unit
9 |
--------------------------------------------------------------------------------
/tests/purs/warning/UnusedFFIImplementations.js:
--------------------------------------------------------------------------------
1 | exports.yes = true;
2 | exports.no = false;
3 |
--------------------------------------------------------------------------------
/tests/purs/warning/UnusedFFIImplementations.purs:
--------------------------------------------------------------------------------
1 | -- @shouldWarnWith UnusedFFIImplementations
2 | module Main where
3 |
4 | foreign import yes :: Boolean
5 |
--------------------------------------------------------------------------------
/tests/purs/warning/UnusedImport.purs:
--------------------------------------------------------------------------------
1 | -- @shouldWarnWith UnusedImport
2 | -- @shouldWarnWith UnusedImport
3 | module Main where
4 |
5 | import Data.Unit (Unit, unit)
6 |
7 | -- All of the below are unused
8 | import Effect
9 | import Effect.Console as Console
10 |
11 | main :: Unit
12 | main = unit
13 |
--------------------------------------------------------------------------------
/tests/purs/warning/UnusedTypeVar.purs:
--------------------------------------------------------------------------------
1 | -- @shouldWarnWith UnusedTypeVar
2 | module Main where
3 |
4 | f :: forall a b. a -> a
5 | f x = x
6 |
--------------------------------------------------------------------------------
/tests/purs/warning/WildcardInferredType.purs:
--------------------------------------------------------------------------------
1 | -- @shouldWarnWith WildcardInferredType
2 | -- @shouldWarnWith WildcardInferredType
3 | module Main where
4 |
5 | x = 0 :: _
6 |
7 | y :: _
8 | y = 0
9 |
10 | z :: Int
11 | z =
12 | let n :: _
13 | n = 0
14 | in n
15 |
--------------------------------------------------------------------------------
/tests/purs/warning/WildcardInferredType2.purs:
--------------------------------------------------------------------------------
1 | -- @shouldWarnWith WildcardInferredType
2 | module Main where
3 |
4 | x :: _
5 | x = 42
6 |
7 | y :: Int
8 | y = 42 :: _
9 |
10 | z :: Int
11 | z = n
12 | where
13 | n :: _
14 | n = 42
--------------------------------------------------------------------------------
/tests/support/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules/
2 | bower_components/
3 |
--------------------------------------------------------------------------------
/tests/support/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "private": true,
3 | "dependencies": {
4 | "bower": "^1.8.8",
5 | "glob": "^5.0.14",
6 | "rimraf": "^2.5.2"
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/tests/support/prelude-resolutions.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/tests/support/psci/InteractivePrint.purs:
--------------------------------------------------------------------------------
1 | -- A module for testing the :print feature for configuring the function used
2 | -- for printing repl results
3 | module InteractivePrint where
4 |
5 | import Prelude
6 | import Effect (Effect)
7 | import Effect.Console (log)
8 | import Unsafe.Coerce (unsafeCoerce)
9 |
10 | unsafeEval :: forall a. a -> Effect Unit
11 | unsafeEval = log <<< unsafeCoerce
12 |
--------------------------------------------------------------------------------
/tests/support/psci/Reload.edit:
--------------------------------------------------------------------------------
1 | module Reload where
2 |
3 | edited :: String
4 | edited = "reload"
5 |
--------------------------------------------------------------------------------
/tests/support/psci/Reload.purs:
--------------------------------------------------------------------------------
1 | module Reload where
2 |
3 | reload :: Int
4 | reload = 0
5 |
--------------------------------------------------------------------------------
/tests/support/pscide/.gitignore:
--------------------------------------------------------------------------------
1 | /bower_components/
2 | /node_modules/
3 | /.pulp-cache/
4 | /output/
5 | /.psci*
6 | /src/.webpack.js
7 | /src/*.tmp
8 |
--------------------------------------------------------------------------------
/tests/support/pscide/src/CompletionSpecDocs.purs:
--------------------------------------------------------------------------------
1 | -- | Module Documentation
2 | module CompletionSpecDocs where
3 |
4 | -- | Doc x
5 | something = "something"
6 |
7 | -- | Doc *123*
8 | withType :: Int
9 | withType = 42
10 |
11 | -- | This is
12 | -- | a multi-line
13 | -- | comment
14 | multiline = "multiline"
--------------------------------------------------------------------------------
/tests/support/pscide/src/FindUsage.purs:
--------------------------------------------------------------------------------
1 | module FindUsage where
2 |
3 | import FindUsage.Definition (usageId, ($%), Usage(..))
4 | import FindUsage.Reexport (toBeReexported)
5 |
6 | usagePatternMatch ∷ Usage → Usage
7 | usagePatternMatch x = case x of
8 | Used _ → x
9 | _ $% _ → x
10 |
11 | usageFn ∷ ∀ a. a → a
12 | usageFn = usageId toBeReexported
13 |
--------------------------------------------------------------------------------
/tests/support/pscide/src/FindUsage/Definition.purs:
--------------------------------------------------------------------------------
1 | module FindUsage.Definition (Usage(..), ($%), usageId, toBeReexported) where
2 |
3 | data Usage
4 | = Used Int
5 | | Usage Int Int
6 |
7 | infixl 2 Usage as $%
8 |
9 | usageId ∷ ∀ a. a → a
10 | usageId x = x
11 |
12 | toBeReexported ∷ ∀ a. a → a
13 | toBeReexported = usageId
14 |
--------------------------------------------------------------------------------
/tests/support/pscide/src/FindUsage/Recursive.purs:
--------------------------------------------------------------------------------
1 | module FindUsage.Recursive where
2 |
3 | data Nat = Suc Nat | Z
4 |
5 | recursiveUsage :: Nat -> Int
6 | recursiveUsage = case _ of
7 | Suc x -> recursiveUsage x
8 | Z -> 0
9 |
--------------------------------------------------------------------------------
/tests/support/pscide/src/FindUsage/RecursiveShadowed.purs:
--------------------------------------------------------------------------------
1 | module FindUsage.RecursiveShadowed where
2 |
3 | data Nat = Suc Nat | Z
4 |
5 | recursiveUsage :: Nat -> Int
6 | recursiveUsage = case _ of
7 | Suc x ->
8 | let recursiveUsage = 3
9 | in recursiveUsage
10 | Z -> 0
11 |
--------------------------------------------------------------------------------
/tests/support/pscide/src/FindUsage/Reexport.purs:
--------------------------------------------------------------------------------
1 | module FindUsage.Reexport (module X) where
2 |
3 | import FindUsage.Definition (toBeReexported) as X
4 |
--------------------------------------------------------------------------------
/tests/support/pscide/src/ImportsSpec.purs:
--------------------------------------------------------------------------------
1 | module ImportsSpec where
2 |
3 | myId x = x
4 |
--------------------------------------------------------------------------------
/tests/support/pscide/src/MatcherSpec.purs:
--------------------------------------------------------------------------------
1 | module MatcherSpec where
2 |
3 | id :: forall a. a -> a
4 | id x = x
5 |
6 | const :: forall a b. a -> b -> a
7 | const x _ = x
8 |
--------------------------------------------------------------------------------
/tests/support/pscide/src/RebuildSpecDep.purs:
--------------------------------------------------------------------------------
1 | module RebuildSpecDep where
2 |
3 | dep = 42
4 |
--------------------------------------------------------------------------------
/tests/support/pscide/src/RebuildSpecSingleModule.fail:
--------------------------------------------------------------------------------
1 | module RebuildSpecSingleModule where
2 |
3 | let anerror
--------------------------------------------------------------------------------
/tests/support/pscide/src/RebuildSpecSingleModule.purs:
--------------------------------------------------------------------------------
1 | module RebuildSpecSingleModule where
2 |
3 | id x = x
4 | lulz x y = x
5 |
--------------------------------------------------------------------------------
/tests/support/pscide/src/RebuildSpecWithDeps.purs:
--------------------------------------------------------------------------------
1 | module RebuildSpecWithDeps where
2 |
3 | import RebuildSpecDep (dep)
4 |
5 | x = dep
6 |
--------------------------------------------------------------------------------
/tests/support/pscide/src/RebuildSpecWithForeign.js:
--------------------------------------------------------------------------------
1 | exports.f = 5;
2 |
--------------------------------------------------------------------------------
/tests/support/pscide/src/RebuildSpecWithForeign.purs:
--------------------------------------------------------------------------------
1 | module RebuildSpecWithForeign where
2 |
3 | foreign import f :: Int
4 |
--------------------------------------------------------------------------------
/tests/support/pscide/src/RebuildSpecWithHiddenIdent.purs:
--------------------------------------------------------------------------------
1 | module RebuildSpecWithHiddenIdent (exported) where
2 |
3 | hidden x _ = x
4 |
5 | exported :: forall a. a -> a
6 | exported x = x
7 |
--------------------------------------------------------------------------------
/tests/support/pscide/src/RebuildSpecWithMissingForeign.fail:
--------------------------------------------------------------------------------
1 | module RebuildSpecWithMissingForeign where
2 |
3 | foreign import f :: Int
4 |
--------------------------------------------------------------------------------
/tests/support/setup-win.cmd:
--------------------------------------------------------------------------------
1 | @echo off
2 | call npm install
3 | call node_modules\.bin\bower install --config.interactive=false
4 |
--------------------------------------------------------------------------------